不知道什么原因,我的JSP页面中无法使用JS,比如添加一个按钮onclick="alert("fuck");"点击无反应,且在网页上也没有提示JS错误,请问这是神马情况?
开发工具MyEclipse6.0,tomcate6.013
开发工具MyEclipse6.0,tomcate6.013
解决方案 »
- jsf标签
- struts2 action获取不到jsp上面的值
- 跪求 Struts+hibernate+spring 项目实例!! 在线等! 不来自己顶!
- web-xml设置问题
- 我想找一个测试的论坛
- 每周排班表页面生成问题
- 菜鸟级问题javaScript!请各位帮助!
- java.lang.IllegalArgumentException: No SqlMapClient specified 求哪位大侠帮忙解决一下!
- 新手 myeclipse问题 大神们快帮帮忙
- 求助:谁有JSP分页程序呀,能提供一个源码吗,谢谢你啦!
- 用myeclipse debug模式启动问题
- jquery中的字符窜转换成json对象
onclick="alert("fuck");" 改成onclick="alert('fuck');"或onclick="alert(\"fuck\");"或onclick='alert("fuck");'
Java 技术交流群:58156559
如果有用的话麻烦楼主散分我下点资料。谢谢!
<script language="javascript">
function testNull()
{
alert("进入函数");
for(var i=0;i<document.getElementById("form1").length;i++){
if(document.getElementById("form1").elements[i].value==""){
alert("您有未填信息");
document.focus();
return false;
}
}
}
function IsAllNumber()
{
alert("进入函数");
/*
var str=document.getElementById("user_id").value;
var reg=/^\d+$/;
if(!reg.test(str)){
alert("学号必须全部是数字");
document.focus();
}
*/
}
function IsMail(){
alert("进入函数");
var Mystr=document.getElementById("user_email").value;
var Myreg=/^[-_A-Za-z0-9]+\.)+[A-Za-z0-9]{2,3}$/;
if(!Myreg.test(Mystr)){
alert("你所输入的不是正确的邮箱格式");
document.focus();
}
}
</script><body><table width="50%" border="0" align="center">
<tr>
<td bordercolor="#66FF99" width="100" height="100"><img src="../shareImages/logo.gif" width=1200 height="50px" /></td>
</tr>
</table>
<form name="form1" id="form1" method="post" action="http://localhost:8080/library/user/regist!regist" >
<table width=600px border="0" align="center">
<tr>
<td class="STYLE1" width="100" height="30" align="center"> 注册学号:</td>
<td class="STYLE1" heitht="30" align="center"><input name="user_id" type="text" id="user_id" /></td>
<td class="STYLE1" height="30" align="center"><input type="button" name="button" value="检测" onclick="IsAllNumber();"/></td>
</tr>
<tr>
<td class="STYLE1" width="100" height="30" align="center">注册密码:</td>
<td class="STYLE1" heitht="30" align="center" ><input name="user_pwd" type="password" /></td>
<td></td>
</tr>
<tr>
<td class="STYLE1" heitht="30" align="center">注册名称:</td>
<td class="STYLE1" heitht="30" align="center"><input name="user_name" type="text" /></td>
<td></td>
</tr>
<input type="button" value="Submit" onclick="alert('fuck');"/>
这个方法写的不对。删了 就能执行了
然后的问题不就是双引号需要转义或者中间双引号换成单引号的问题了吗?怎么错了。
你应该在使用火狐的浏览器 添加一个firebug的组件 这样你就可以系统调试js了。也避免出了问题找不到问题!太茫然。