首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > JAVA > Java Web开发 >

麻烦大家看看小弟我这代码。隐藏的异常

2012-02-29 
麻烦大家看看我这代码。。。。隐藏的错误JScript code%@page contentTypetext/html pageEncodingUTF-8%

麻烦大家看看我这代码。。。。隐藏的错误

JScript code
<%@page contentType="text/html" pageEncoding="UTF-8"%><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"      "http://www.w3.org/TR/html4/loose.dtd"><html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><link href="css\Style_135.css" rel="stylesheet" type="text/css" /><title>完全训练--诗意长廊</title><style>#gn{width:100%;height:30px;float:right;clear: both;text-align:right;padding-right:8px;padding-top:5px;background-color: #FFFFFF;filter:alpha(opacity=35);color:#000000;}#gn table { text-align:right;}#gn td { color:#000000;}#gn a{color:#000000;}</style></head><body topmargin=0 leftmargin=0><div id="menu" class='d'><TABLE><TR><TD><ul><li ><a href="shiyichanglang\01.html" target=list >欣赏作品一</a></li><li  ><a href="03.html" target=list>欣赏作品二</a></li><li  ><a href="05.html" target=list>欣赏作品三</a></li><li  ><a href="06.html" target=list>欣赏作品四</a></li></ul></TD></TR></TABLE></div><TABLE><TR><TD><iframe frameBorder=0 marginHeight=0 marginWidth=0 scrolling=auto src=shiyichanglang\01.html width=800 height=550 name=list></iframe> </td>  </tr></table><br><table width="100%" border="0" cellspacing="10" cellpadding="0">  <tr>    <td width="20%" height="234">&nbsp;</td>    <td width="62%" align="left" valign="top"><form name="form1" onsubmit=createXMLHttpRequest()>          <table width="100%" border="0" cellspacing="10" cellpadding="0">        <tr>          <td width="8%">昵称:</td>          <td colspan="2"><input name="user" type="text" id="user" size="30" maxlength="32"></td>          <td width="37%">&nbsp;</td>          <td width="15%">&nbsp;</td>        </tr>        <tr>          <td height="53">密码:</td>          <td colspan="2"><input name="password" type="password" id="password" size="30" maxlength="32"></td>          <td>路人评论可不用密码 </td>          <td>&nbsp;</td>        </tr>        <tr>          <td height="38">验证码:</td>          <td width="12%"><input name="yanzhengma" type="text" id="yanzhengma" size="10" maxlength="4" value=2011></td>          <td width="28%"><img border=0 src="image"></td>          <td>&nbsp;</td>          <td>&nbsp;</td>        </tr>        <tr>          <td valign="top">内容:</td>          <td colspan="3"><textarea name="neirong" id="neirong" cols="50" rows="10"></textarea></td>          <td>&nbsp;</td>        </tr>        <tr>          <td height="26">&nbsp;</td>          <td><input type="submit" name="tijiao" id="tijiao" value="发表留言" ></td>          <td><input type="button" name="quxiao" id="quxiao" value="取消"></td>          <td>&nbsp;</td>          <td>&nbsp;</td>        </tr>      </table>    </form></td>    <td width="18%">&nbsp;</td>  </tr></table><div id="pinglun"></div></body><script charSet="utf-8">    var httprequest,yanzhengma;    function createXMLHttpRequest(){        alert("成功访问函数createXMLHttpRequest()");        if (window.XMLHttpRequest) {            httprequest = new XMLHttpRequest();        } else if (window.ActiveXObject) {            httprequest = new ActiveXObject("Microsoft.XMLHTTP");        }        yanzhengma=document.getElementById("yanzhengma").vlaue        url="dengruserver.do?username="+yanzhengma";        httprequest.open('GET', url, true);        httprequest.onreadystatechange = OnStatusChange;        httprequest.send();    }    function OnStatusChange()      {        if (httprequest.readyState == 4) // 完全接受        {            if (httprequest.status == 200) // 服务器已经成功响应            {                   alert("访问服务器成功");                document.getElementById('pinglun').innerHTML = httprequest.responseText;            } else // 访问出错            {                //alert(httprequest.responseText);                alert("访问出错");            }        }    }</script></html>


当我点击发表留言按钮时,只实现了刷新,并没有连接到后台,就是alert("成功访问函数createXMLHttpRequest()");
这句代码也没执行。。就是说,它并没有执行createXMLHttpRequest()这个函数!!!似乎不应该出现的错误呀!!!


[解决办法]
你javascript里url="dengruserver.do?username="+yanzhengma";写多了个引号
应该是url="dengruserver.do?username="+yanzhengma;

热点排行