[求助]如何输出JavaScript变量 |
<html>
<head>
<script language="JavaScript">
<!-- Hide
var scrtxt="怎麽样 ! 很酷吧 ! 您也可以试试."+"Here goes your message the visitors to your page will "+"look at for hours in pure fascination...";
var lentxt=scrtxt.length;
var width=100;
var pos=1-width;
function scroll() {
pos++;
var scroller="";
if (pos==lentxt) {
pos=1-width;
}
if (pos<0) {
for (var i=1; i<=Math.abs(pos); i++) {
scroller=scroller+" ";}
scroller=scroller+scrtxt.substring(0,width-i+1);
}
else {
scroller=scroller+scrtxt.substring(pos,width+pos);
}
window.status = scroller;
setTimeout("scroll()",150);
}
//-->
</script>
</head>
<body onLoad="scroll();return true;">
这里可显示您的网页 !
<input type="text" name="piv" value="">
</body>
</html>
如果在调试程序的时候,要输出变量scroller,该怎么写?
顺便请问一个问题:在调试javascript的时候,如何比较明了输出每个变量,就像PHP用echo函数,请赐教,能不能就在上面的程序举例说明,感谢你们的无私奉献的解答
|
|
|