javascript缺少对象
<!--#includefile="include/function.asp"--><styletype="text/css"><!--.topgreenborder{b...
<!--#include file = "include/function.asp"-->
<style type="text/css">
<!--
.topgreenborder {
border-top-width: 1px;
border-top-style: dotted;
border-top-color: #006600;
}
.greenborder {
border: 1px solid #336633;
}
-->
</style>
<script language="JavaScript" type="text/JavaScript">
function uid_keypress(e)
{
if(event.keyCode == 13)
{
event.keyCode = 0;
document.form1.pwd.focus();
}
}
function pwd_keypress(e)
{
if(event.keyCode == 13)
{
event.keyCode = 0;
loginSubmit();
}
}
function loginSubmit()
{
var uid = document.form1.uid;
var pwd = document.form1.pwd;
if(uid.value.Trim().length == 0)
{
alert('请输入用户名');
uid.select();
return;
}
if(pwd.value.length == 0)
{
alert('请输入密码');
pws.select();
return;
}
form1.target ="_self";
form1.action = "#";
form1.submit();
}
</script>
<form name="form1">
<table width="200" border="0" cellspacing="0" cellpadding="0" style="font-size:12px">
<tr>
<td class="greenborder"><img src="images/login.gif" width="198" height="28"></td>
</tr>
<tr>
<td><%if not IsLogined then%>
<table class="greenborder" width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="right">用户名:</td>
<td align="left" valign="middle"><input name="uid" type="text" size="10" maxlength="20"></td>
<td align="center" valign="middle"><a href="javascript:loginsubmit()"><img src="images/hydl0-1.gif" border="0"></a></td>
</tr>
<tr>
<td class="topgreenborder" align="right">密码:</td>
<td align="left" valign="middle"><input name="pwd" type="text" size="10" maxlength="20"></td>
<td class="topgreenborder" align="center" valign="middle"><a href="regist/regfirst.asp"><img src="images/hydl0-2.gif" border="0"></a></td>
</tr>
<tr>
<td class="topgreenborder" colspan="3" align="center" valign="middle">
<input type="radio" name="radiobutton" value="radiobutton">
个人用户
<input name="radiobutton" type="radio" value="radiobutton" checked>
企业用户</td>
</tr>
</table>
<%else%>
<table class="greenborder" width="100%" height="100%">
<tr><td align="center" valign="middle"><font>欢迎登陆中国牙科器材代理网</font></td></tr>
<tr><td class="topgreenborder" valign="middle"> <font color="#FF0000">会员中心</font>‖‖注销登陆</td></tr>
</table>
<%end if%>
</td>
</tr>
</table>
</form>
因为登陆按钮是个图片,所以使用链接提交。用javascript
但是老是提示 缺少对象。不知道是什么原因。
望诸位高手指教!! 展开
<style type="text/css">
<!--
.topgreenborder {
border-top-width: 1px;
border-top-style: dotted;
border-top-color: #006600;
}
.greenborder {
border: 1px solid #336633;
}
-->
</style>
<script language="JavaScript" type="text/JavaScript">
function uid_keypress(e)
{
if(event.keyCode == 13)
{
event.keyCode = 0;
document.form1.pwd.focus();
}
}
function pwd_keypress(e)
{
if(event.keyCode == 13)
{
event.keyCode = 0;
loginSubmit();
}
}
function loginSubmit()
{
var uid = document.form1.uid;
var pwd = document.form1.pwd;
if(uid.value.Trim().length == 0)
{
alert('请输入用户名');
uid.select();
return;
}
if(pwd.value.length == 0)
{
alert('请输入密码');
pws.select();
return;
}
form1.target ="_self";
form1.action = "#";
form1.submit();
}
</script>
<form name="form1">
<table width="200" border="0" cellspacing="0" cellpadding="0" style="font-size:12px">
<tr>
<td class="greenborder"><img src="images/login.gif" width="198" height="28"></td>
</tr>
<tr>
<td><%if not IsLogined then%>
<table class="greenborder" width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="right">用户名:</td>
<td align="left" valign="middle"><input name="uid" type="text" size="10" maxlength="20"></td>
<td align="center" valign="middle"><a href="javascript:loginsubmit()"><img src="images/hydl0-1.gif" border="0"></a></td>
</tr>
<tr>
<td class="topgreenborder" align="right">密码:</td>
<td align="left" valign="middle"><input name="pwd" type="text" size="10" maxlength="20"></td>
<td class="topgreenborder" align="center" valign="middle"><a href="regist/regfirst.asp"><img src="images/hydl0-2.gif" border="0"></a></td>
</tr>
<tr>
<td class="topgreenborder" colspan="3" align="center" valign="middle">
<input type="radio" name="radiobutton" value="radiobutton">
个人用户
<input name="radiobutton" type="radio" value="radiobutton" checked>
企业用户</td>
</tr>
</table>
<%else%>
<table class="greenborder" width="100%" height="100%">
<tr><td align="center" valign="middle"><font>欢迎登陆中国牙科器材代理网</font></td></tr>
<tr><td class="topgreenborder" valign="middle"> <font color="#FF0000">会员中心</font>‖‖注销登陆</td></tr>
</table>
<%end if%>
</td>
</tr>
</table>
</form>
因为登陆按钮是个图片,所以使用链接提交。用javascript
但是老是提示 缺少对象。不知道是什么原因。
望诸位高手指教!! 展开
3个回答
展开全部
<script language="JavaScript" type="text/JavaScript">
function uid_keypress(e)
{
if(event.keyCode == 13)
{
event.keyCode = 0;
document.form1.pwd.focus();
}
}
function pwd_keypress(e)
{
if(event.keyCode == 13)
{
event.keyCode = 0;
loginSubmit();
}
}
function loginsubmit(){
var uid = document.form1.uid;
var pwd = document.form1.pwd;
if(uid.value.length == 0)
{
alert('请输入用户名');
uid.select();
return;
}
if(pwd.value.length == 0)
{
alert('请输入密码');
pws.select();
return;
}
form1.target ="_self";
form1.action = "#";
form1.submit();
}
</script>
问题出在打星号的地方 1.loginsubmit()后面有后空格之类的字符 跟后面的括号分开了 所以提示出错了 2. uid 对象不支持Trim().length
function loginSubmit() *****
{ ****
var uid = document.form1.uid;
var pwd = document.form1.pwd;
if(uid.value.Trim().length == 0) ****
function uid_keypress(e)
{
if(event.keyCode == 13)
{
event.keyCode = 0;
document.form1.pwd.focus();
}
}
function pwd_keypress(e)
{
if(event.keyCode == 13)
{
event.keyCode = 0;
loginSubmit();
}
}
function loginsubmit(){
var uid = document.form1.uid;
var pwd = document.form1.pwd;
if(uid.value.length == 0)
{
alert('请输入用户名');
uid.select();
return;
}
if(pwd.value.length == 0)
{
alert('请输入密码');
pws.select();
return;
}
form1.target ="_self";
form1.action = "#";
form1.submit();
}
</script>
问题出在打星号的地方 1.loginsubmit()后面有后空格之类的字符 跟后面的括号分开了 所以提示出错了 2. uid 对象不支持Trim().length
function loginSubmit() *****
{ ****
var uid = document.form1.uid;
var pwd = document.form1.pwd;
if(uid.value.Trim().length == 0) ****
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
Trim()方法是JAVA里面的,JAVASCRIPT中没有这个方法,你最好自己写一个
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
String.prototype.Trim = function() { return this.replace(/(^\s*)|(\s*$)/g, ""); }
把这个加到你的script脚本块里面.
把这个加到你的script脚本块里面.
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询