日期:2014-05-16 浏览次数:20362 次
<script language="javascript" type="text/javascript" > function display() { //DispWin = window.open("about:blank", 'NewWin ', 'toolbar = no,status = no,width = 300,heght = 200 ') //根据测试,是上面那句写错了 DispWin=window.open(); for(var i = 0;i < document.form1.selection.length;i ++) { if(document.form1.selection[i].checked) { message1 = document.form1.selection[i].value + " </br >"; DispWin.document.write(message1); } } message1 = document.all.form1.others.value; DispWin.document.write(message1); } </script > <form name="form1" > 请选择您的爱好: <input type="checkbox" name="selection" value="打球" / >打球 <input type="checkbox" name="selection" value="玩游戏" / >玩游戏 <input type="checkbox" name="selection" value="上网" / >上网 <input type="checkbox" name="selection" value="泡妞" / >泡妞 <input type="checkbox" name="selection" value="踢球" / >踢球 其它: <input type="text" name="others" value="" / > <br / > <input type="button" value="显示" onclick="display();" / > <br / > </form >
------解决方案--------------------
<script language="javascript" type="text/javascript"> function display() { DispWin = window.open("",'NewWin','toolbar = no,status = no,width = 300,heght = 200') // DispWin=window.open(); message = "您的姓名是:" + document.form1.name.value + " <br/>"; message += "您的籍贯是:" + document.form1.address.value + " <br/>"; DispWin.document.write(message); message = "您的年龄是:"; DispWin.document.write(message); for ( var i = 0;i < document.form1.age.length;i ++) { if ( document.form1.age[i].checked ) { message = document.form1.age[i].value + " <br/>"; DispWin.document.write(message); } } message = "您的爱好是:"; DispWin.d