|
popup = window.open(URL,"MenuPopup",windowprops); } // End --> </script> <table> <tr> <td> <form name=popupform> <pre> 打开页面的参数<br> 离开左边的距离: <input type=text name=left size=2 maxlength=4> pixels 离开右边的距离: <input type=text name=top size=2 maxlength=4> pixels 窗口的宽度: <input type=text name=width size=2 maxlength=4> pixels 窗口的高度: <input type=text name=height size=2 maxlength=4> pixels </pre> <center> <input type=button value="打开这个窗口!" onClick="popupPage(this.form.left.value, this.form.top.value, this.form.width.value, this.form.height.value)"> </center> </form> </td> </tr> </table>你只要在相对应的对话框中输入一个数值即可,将要打开的页面的窗口控制得很好。 44、页面的打开移动 把如下代码加入<body>区域中 <script LANGUAGE="Javascript"> <!-- Begin for (t = 2; t > 0; t--) { for (x = 20; x > 0; x--) { for (y = 10; y > 0; y--) { parent.moveBy(0,-x); } } for (x = 20; x > 0; x--) { for (y = 10; y > 0; y--) { parent.moveBy(0,x); } } for (x = 20; x > 0; x--) { for (y = 10; y > 0; y--) { parent.moveBy(x,0); } } for (x = 20; x > 0; x--) { for (y = 10; y > 0; y--) { parent.moveBy(-x,0); } } } //--> // End --> </script> 45、显示个人客户端机器的日期和时间 <script language="Livescript"> <!-- Hiding today = new Date() document.write("现 在 时 间 是: ",today.getHours(),":",today.getMinutes()) document.write("<br>今 天 日 期 为: ", today.getMonth()+1,"/",today.getDate(),"/",today.getYear()); // end hiding contents --> </script> 46、自动的为你每次产生最後修改的日期了: <html> <body> This is a simple HTML- page. <br> Last changes: <script language="Livescript"> <!-- hide script from old browsers document.write(document.lastModified) // end hiding contents --> </script> </body> </html> 47、不能为空和邮件地址的约束: <html> <head> <script language="Javascript"> <!-- Hide function test1(form) { if (form.text1.value == "") alert("您 没 写 上 任 何 东 西, 请 再 输 入 一 次 !") else { alert("嗨 "+form.text1.value+"! 您 已 输 入 完 成 !"); } } function test2(form) { if (form.text2.value == "" || form.text2.value.indexOf(’@’, 0) == -1) alert("这 不 是 正 确 的 e-mail address! 请 再 输 入 一 次 !"); else alert("您 已 输 入 完 成 !"); } // --> </script> </head> <body> <form name="first"> Enter your name:<br> <input type="text" name="text1"> <input type="button" name="button1" value="输 入 测 试" onClick="test1(this.form)"> <P> Enter your e-mail address:<br> <input type="text" name="text2"> <input type="button" name="button2" value="输 入 测 试" onClick="test2(this.form)"> </body> 48、跑马灯 <html> <head> <script language="Javascript">
|