新視窗永遠置中
<script language="javascript">
<!--
function openwindow( url, winName, width, height)
{
xposition=0; yposition=0;
if ((parseInt(navigator.appVersion) >= 4 ))
{
xposition = (screen.width - width) / 2;
yposition = (screen.height - height) / 2;
}
theproperty= "width=" + width + ","
+ "height=" + height + ","
+ "location=0,"
+ "menubar=0,"
+ "resizable=1,"
+ "scrollbars=0,"
+ "status=0,"
+ "titlebar=0,"
+ "toolbar=0,"
+ "hotkeys=0,"
+ "screenx=" + xposition + "," //僅適用於Netscape
+ "screeny=" + yposition + "," //僅適用於Netscape
+ "left=" + xposition + "," //IE
+ "top=" + yposition; //IE
window.open( url,winName,theproperty );
}
//-->
</script>
<a href="javascript:openwindow('tan2.htm','anyname',300,300)">
開啟視窗</a>
文字框只有下線的CSS
<input name="reviewone" size="15" style="color: rgb(255,0,0); border-left: medium
none; border-right: medium none; border-top: medium none; border-bottom: 1px solid
rgb(192,192,192)">
全選全不選
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
var checkflag = "false";
function check(field) {
if (checkflag == "false") {
for (i = 0; i < field.length; i++) {
field[i].checked = true;}
checkflag = "true";
return "Uncheck All"; }
else {
for (i = 0; i < field.length; i++) {
field[i].checked = false; }
checkflag = "false";
return "Check All"; }
}
// End -->
</script>
<form name=myform action="" method=post>
<table>
<tr><td>
<b>請選擇下面的選項</b><br>
<input type=checkbox name=list value="1">Java<br>
<input type=checkbox name=list value="2">JavaScript<br>
<input type=checkbox name=list value="3">ASP<br>
<input type=checkbox name=list value="4">HTML<br>
<input type=checkbox name=list value="5">SQL<br>
<br>
<input type=button value="Check All" onClick="this.value=check(this.form.list)">
</td></tr>
</table>
</form>
按"全選"按鈕就可以全選文字框內文字
<form>
<input type=button value="全選"
onClick="javascript:this.form.txt.focus();this.form.txt.select();"><br>
<textarea NAME="txt" ROWS=10 COLS=35 WRAP=VIRTUAL>
按一下"全選"按鈕就可以選中這些字</textarea>
</form>
檢測選擇複選框個數
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
function anyCheck(form) {
var total = 0;
var max = form.ckbox.length;
for (var idx = 0; idx < max; idx++) {
if (eval("document.playlist.ckbox[" + idx + "].checked") == true) {
total += 1;
}
}
alert("你選擇了 " + total + " 個選項.");
}
// End -->
</script>
<form method="post" name=playlist>
1<input type=checkbox name=ckbox>
2<input type=checkbox name=ckbox>
3<input type=checkbox name=ckbox>
4<input type=checkbox name=ckbox>
5<input type=checkbox name=ckbox>
6<input type=checkbox name=ckbox>
7<input type=checkbox name=ckbox>
8<input type=checkbox name=ckbox>
9<input type=checkbox name=ckbox>
<p><center><input type=button value="檢測選擇個數" onClick="anyCheck(this.form)">
</center></form>
滑鼠完全的被封鎖
<body oncontextmenu="return false" ondragstart="return false" onselectstart="return
false">
新視窗重新整理父視窗的幾種方式
父窗連結:
<a href="javascript:void" onClick="window.open('window.htm','','...')">開新窗</a>
新視窗:
1、點按鈕或文字
<a href="javascript:opener.location.reload()">重新整理</a>
2、開窗時重新整理
<body onload="opener.location.reload()">
3、關閉時重新整理
<body onUnload="opener.location.reload()">