----获得列表框的值--------------------------------------------------------------------
<script language="javascript">
function topage(item)
{
var thisValue=1;
//if(item.selectedIndex!=0) 这句加上则选第一个时不会有值
//{
thisValue=item.options[item.selectedIndex].value;
//}
alert(thisValue);
}
</script>
<table>
<tr>
<td><select >
<option value="aaa">aaa</option>
<option value="bbb">bbb</option>
<option value="ccc">ccc</option>
<option value="ddd">ddd</option>
</select>
</td>
</tr>
</table>
-----获得表格的宽度------------------------------------------------------------------------
<script language=javascript>
function showwidth()
{
var td=document.getElementById("thistable");
alert(td.width);
}
</script>
<table width="99%" height="317" border="0" cellspacing="1">
<tr>
<td height="32" align="right"> </td>
<td><a href="new_index.jsp" target="_blank">新闻首页</a></td>
</tr>
<tr>
<td width="18%" align="right">新闻标题:</td>
<td width="82%"><input type="text" size="40" maxlength="50" /></td>
</tr>
</table>
<input type=button value=获取 >
---------------------------------------------------------------------------------------------
1。打开窗口:
var handle = window.showModalDialog(url, objects, feathers);
其中:objects可以为参数(包括数组),也可以是对象。
通常的用法 objects = {window} ,把父窗体的对象共享给子窗体。
2。关闭子窗口:
window.close();
3。从子窗体传参数给父窗体:
window.returnVal = string;
3。清除缓存,防止模式窗口页面不更新的情况:
HTML
<META HTTP-EQUIV="pragma" CONTENT="no-cache">
<META HTTP-EQUIV="Cache-Control" CONTENT="no-cache, must-revalidate">
<META HTTP-EQUIV="expires" CONTENT="Mon, 23 Jan 1978 20:52:30 GMT">
4。防止打开新窗口(如提交表单):
<base target="_self">
between <head> and </head>
5。在模式窗口使用F5刷新页面:
<base target="_self">
<body (event.keyCode==116){reload.click()}">
<a href="filename.htm" style="display:none">reload...</a>
其中:filename为窗口页面。
6。防止模式窗口打开的页面出现cookie丢失的情况:
模式窗口打开新窗口时,仅可以使用 showModalDialog(url,window,feathers); 方法,且 objects 为 window 。
7。在弹出窗口中获得或设置主窗口的任何值:
打开弹出窗口时用:showModalDialog(url, window, feathers)
在弹出窗口中使用 window.dialogArguments 对象(即主窗口传递过来的 window 对象集),即可以获得或者设置主窗口的值。
--------------------------------------------------------------------------------------------------
javascript中,使用window.open方法打开一个子窗口后,可以使用以下方法在子窗口中获得父窗口的路径
<script language=javascript>
var a=window.opener.window.location;
</script>
此时a的值即为父窗口的路径。
---------------------------------------------------------------------------------------------------