<html xmlns="http://www.w3.org/1999/xhtml"> 
<head> 
<title>无标题文档 </title> 
</head> 
<script language="javascript"> 
function checkq() 
{
var us=document.getElementById("us"); 
var pw=document.getElementById("pw"); 
if (us.value!='' &&  pw.value!='')//
{  
 document.hh.submit();

}
</script> 
<body> 
<form action="lgreg.asp" method="get" name="hh"> 
<table align="right" style=" position:absolute;left:800;top:200" > 
<tr> <td>帐号 </td> <td> <input type="text" name="us"> </td> 
<tr> <td>密码 </td> <td> <input type="password" name="pw"> </td> 
<tr> <td> <input type="button" onClick="checkq()" value="登陆" > </td> <td> <input type="reset" > </td> 
</table> 
</form> 
</body> 
</html>

解决方案 »

  1.   


    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <title>无标题文档 </title>
    </head>
    <script language="javascript">
    function checkq()
    {var us=document.getElementById("us");
    var pw=document.getElementById("pw");
    var hh=document.getElementById("hh");
    if (us.value!='' &&  pw.value!=''){ 
    hh.submit()
    }
    else
    {
     alert('帐号或密码不能为空');
    }
    }
    </script>
    <body>
    <form action="测试6.aspx" method="get" name="hh">
    <table align="right" style=" position:absolute;left:800;top:200" >
    <tr> <td>帐号 </td> <td> <input type="text" name="us"> </td>
    <tr> <td>密码 </td> <td> <input type="password" name="pw"> </td>
    <tr> <td> <input type="button" onClick="checkq()" value="登陆" > </td> <td> <input type="reset" > </td>
    </table>
    </form>
    </body>
    </html>
      

  2.   

    response.Write("<script language='javascript'> window.alert("& stri &");location.href='login.html'</script>")
    那错了 ?
      

  3.   

    没错啊 
    至少下面的是对的
    <%
     stri="123"
    response.Write(" <script language='javascript'> window.alert("& stri &");location.href='login.html' </script>") 
    %>
      

  4.   

    多明显的错误,如果stri是个数值,当然没错,如果你的stri 是个字符串呢,stri = "abcsdfg"客户端看到的就是
    window.alert(abcsdfg)....
    abcsdfg是个变量么?不是,就报错了呗
      

  5.   

    应该是
    response.Write("  <script language='javascript'> window.alert('"& stri &"');location.href='login.html'  </script>")  
      

  6.   

    response.Write(" <script language='javascript'> window.alert('& stri &');location.href='login.html' </script>");
    alert里面用单引号;
    语句以分号结束