新窗口永远居中

<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()">
posted on 2006-03-08 08:47  竹子  阅读(479)  评论(0编辑  收藏  举报