文森特去哪直播了:请教为什么不执行Function函数
来源:百度文库 编辑:神马品牌网 时间:2024/10/06 09:49:15
<form action="" method="post" name="myform" id="myform">
<table width="100%" border="0" align="center" cellpadding="2" cellspacing="2">
<tr>
<td>书式类型</td>
<td colspan="2">
<select name="shutype">
<option value="1" selected>专利</option>
<option value="2" >商标</option>
<option value="3" >版权</option>
</select> </td>
</tr>
<tr>
<td>书式名称:</td>
<td colspan="2"><input name="shuname" type="text" id="shuname" size="30"></td>
</tr>
<tr>
<td><span class="blog1">*</span>文件名</td>
<td colspan="2">
<input name="filename" type="text" id="filename" size="30" VALUE="" onFocus="this.value=''">
<input type="button" name="Submit2" value="上 传" onClick="javascript:window.open('../upme.htm','','width=580,height=160,toolbar=no, status=no, menubar=no, resizable=yes, scrollbars=no');return false;"></td>
</tr>
<tr align="center">
<td colspan="2">
<input name="AddProSubmit" type="submit" id="AddProSubmit" onClick="check()" value="添加">
<script language="JavaScript">
<!--
function checkuu()
{
if(document.loginfo.username.value=="") {
alert("请输入您的用户名!");
document.loginfo.username.focus();
return false;
}
if(document.loginfo.password.value=="") {
alert("请输放您的密码!");
document.loginfo.password.focus();
return false;
}
}
//-->
</script></td>
</tr>
</table>
</form>
<table width="100%" border="0" align="center" cellpadding="2" cellspacing="2">
<tr>
<td>书式类型</td>
<td colspan="2">
<select name="shutype">
<option value="1" selected>专利</option>
<option value="2" >商标</option>
<option value="3" >版权</option>
</select> </td>
</tr>
<tr>
<td>书式名称:</td>
<td colspan="2"><input name="shuname" type="text" id="shuname" size="30"></td>
</tr>
<tr>
<td><span class="blog1">*</span>文件名</td>
<td colspan="2">
<input name="filename" type="text" id="filename" size="30" VALUE="" onFocus="this.value=''">
<input type="button" name="Submit2" value="上 传" onClick="javascript:window.open('../upme.htm','','width=580,height=160,toolbar=no, status=no, menubar=no, resizable=yes, scrollbars=no');return false;"></td>
</tr>
<tr align="center">
<td colspan="2">
<input name="AddProSubmit" type="submit" id="AddProSubmit" onClick="check()" value="添加">
<script language="JavaScript">
<!--
function checkuu()
{
if(document.loginfo.username.value=="") {
alert("请输入您的用户名!");
document.loginfo.username.focus();
return false;
}
if(document.loginfo.password.value=="") {
alert("请输放您的密码!");
document.loginfo.password.focus();
return false;
}
}
//-->
</script></td>
</tr>
</table>
</form>
你想在单击“添加”时执行 checkuu 这个函数是吗?
那你这里就写错了。
<input name="AddProSubmit" type="submit" id="AddProSubmit" onClick="check()" value="添加">
其中的 onClick="check()" 应该要和下面的函数名相同,即:onClick="checkuu()"
你的名字挺熟,
我可能以前回答过你的问题吧……?
alt F11打开VBE,
插入—模块
然后把自己定义的函数放到新插入的模块中
在excel中使用即可。
使用方法和EXCEL内置函数一样。
还有你的代码有错误,
一是character这个变量未定义,
二是倒数第三行应该是next i,你的是nexit i
我替你改正了,你的这个函数效果还不错:)
Function REMOVESPACES(cell) As String
Dim CellLength As Integer
Dim Temp, Character As String
Dim i As Integer
CellLength = Len(cell)
Temp = ""
For i = 1 To CellLength
Character = Mid(cell, i, 1)
If Character