大家都是怎么调试程序的啊,我快被JS折磨死了
在IE中还提示网页有错误,在FF中什么都没有,大家说该怎样判断错误在哪啊?
------解决方案--------------------alert...........alert...............alert(在每一步中不断重复,根据输出的值,或有没反应,可以查看出相应的错误代码,在局部改错)
------解决方案--------------------妥了,双引号要转义,或者改为单引号!
L@_@K
<body>
<li> <a href= "# " class= "tab1 " onclick= "displayboard( 'mainright '); "> 给我留言 </a> </li>
<div id= "target "> </div>
<script type= "text/javascript ">
<!--
function displayboard(target)
{
var div= " <div id=\ "board\ "> ";
div+= " <form name= 'form1 ' id= 'form1 ' action=\ "leavemes.php\ " method= 'post '> ";
div+= "称呼: <input name=\ "yourname\ " id=\ "yourname\ " type=\ "text\ " /> ";
div+= "内容: <textarea name=\ "content\ " cols=\ "20\ " rows=\ "10\ " > </textarea> ";
div+= " <input name=\ "submit\ " id=\ "submit\ " type=\ "submit\ " value=\ "提交\ "/> ";
div+= " </form> ";
div+= " </div> ";
document.getElementById( "target ").innerHTML=div;
}
//-->
</script>
</body>
------解决方案-------------------- function displayboard(target)
{
var div= " <div id= 'board '> ";
div+= " <form name= 'form1 ' id= 'form2 ' action= 'leavemes.php ' method= 'post '> ";
div+= "称呼: <input name= 'yourname ' id= 'yourname ' type= 'text ' /> ";
div+= "内容: <textarea name= 'content ' cols= '20 ' rows= '10 ' > </textarea> ";
div+= " <input name= 'submit ' id= 'submit ' type= 'submit ' value= '提交 '/> ";
div+= " </form> ";
div+= " </div> ";
document.getElementById(target).innerHTML=div;
}
------解决方案--------------------脚本的双引 全部还成单引号