关于js中调用函数是提示缺少对象的问题 想用一下语句调用函数giveReport2,但是总是提示缺少对象,求各位解答,谢谢document.writeln("<br/><input name=\"report2\" type=\"button\" value=\"See the correct answers\" size=\"10\" onclick=\"giveReport2()\"/>"); 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 缺少对象就是你程序找不到你的函数,你再仔细看看,或者你把函数里面的东西全部删掉,就加1个alert(1)看什么反应 document.writeln("<br/><input name=\"report2\" type=\"button\" value=\"See the correct answers\" size=\"10\" onclick='giveReport2()'/>"); 不会用调试器么?firebug也行啊 测试没有错误啊,查看下giveReport2()方法定义或者内部有没有错误<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><html> <head> <title> New Document </title> <meta name="Generator" content="EditPlus"> <meta name="Author" content=""> <meta name="Keywords" content=""> <meta name="Description" content=""> </head> <body> <script type="text/javascript"> var giveReport2=function(){alert("ok");} document.writeln("<br/><input name=\"report2\" type=\"button\" value=\"See the correct answers\" size=\"10\" onclick=\"giveReport2()\"/>"); </script> </body></html> 查看giveReport2()中是否有错误。 giveReport2()函数没有问题 ,而且在这里不管调用那个函数都是显示说没有对象 是调用客户端的函数?OnClientClick="return giveReport2()" 是不是你调用giveReport2()的时候用到this之类的了,要是用到了建议这样写onclick = "giveReport2(this)" 发现了点问题了,好像是在第一次调用一个函数时都可以用,但是在这个函数中在调用别的函数就不行了,相当于前面的其他变量值都没有了,这种情况是否必须用到cookie啊 遍历json 然后定时操作.. 2个TAB自动切换,第2个自动切换有BUG,哪个高手帮修正下谢谢!! 怎么让2个getElementById同事存在 jquery colorbox疑问 请问如何实现图片和文字同时变换的效果! 在网页里能知道事件或者消息吗?急! 接贴子《高手请进,请问如何把要投票选定的产品的值传递到相应的文本框中。》有问题,请各高手再发表高见!高分相送!! 一个帧同时提交给其他两个帧的问题? 怎样动态地加入外部JS文件? 如何动态改变下拉框每行的颜色? 谁能帮我详解一下,window.open打开新页面时出现的怪现象? TT浏览器不支持location?百分百结贴率,看清楚
你再仔细看看,
或者你把函数里面的东西全部删掉,
就加1个alert(1)
看什么反应
<html>
<head>
<title> New Document </title>
<meta name="Generator" content="EditPlus">
<meta name="Author" content="">
<meta name="Keywords" content="">
<meta name="Description" content="">
</head> <body>
<script type="text/javascript">
var giveReport2=function(){alert("ok");}
document.writeln("<br/><input name=\"report2\" type=\"button\" value=\"See the correct answers\" size=\"10\" onclick=\"giveReport2()\"/>");
</script>
</body>
</html>
OnClientClick="return giveReport2()"
的时候用到this之类的了,要是用到了建议这样写onclick = "giveReport2(this)"