form中有二个select,一个是年,一个是月,想通过两个select的onchange事件,自动刷新页面,并根据select中的值自动生成一个多行的表格,可以进行进一步的输入。如:选择2008年2月,就生成一个29行的表格。选择2008年5月就生成31行的表格,在表格的第一列加上日期。
解决方案 »
- javascript思考题
- Tree和panel不得不说的事~~!!求救~~~
- jquery 如何获取字体颜色为红色的元素
- 两个数组日期做判断的问题。
- 请真正的JavaScript高手解答
- 为什么我的js跳转不成功!郁闷
- 我的index.asp中有 <iframe name="myiframe" width="300" height="600" src="1.htm"></iframe>
- 有没有办法在JS中写ASP脚本
- 国内哪里的论坛,讨论flashMX里的actionScript?请推荐几个
- 在框架中,我为什么不能控制住最下帧?
- 如何高亮显示当前链接?????
- iframe HTML编辑器 快捷键提交的问题
//去实现的想法啊
};
<script language="javaScript">function select354(obj){
if (obj.value == "1"){
zj_num.style.display = "none";
zj_type.style.display = "none";
no_num.style.display = "block";
}
if (obj.value == "2"){
zj_num.style.display = "block";
zj_type.style.display = "block";
no_num.style.display = "none";
}
}
</script>
</head>
<body scroll="no">
<table width="100%" height="100%" border="0" cellspacing="0" cellpadding="0" class="maintable">
<tr>
<td width="4">
<img src="../../images/core/spacer.gif" width="4" height="4">
</td>
<td width="100%" height="100%">
<table width="100%" height="100%" border="0" cellspacing="0" cellpadding="0">
<tr height="100%">
<td align="center" valign="top" class="center">
<table width="350" border="0" cellpadding="0" cellspacing="0" align="center">
<tr>
<td align="center"><form name="form1" method="post" action="">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td align="right">查询方式</td>
<td><select name="selectcha" onChange="select354(this)" id="selectcha">
<option value="1" selected="selected">卡号</option>
<option value="2">证件号</option>
</select></td>
</tr>
<tr id="no_num" style="display:block;">
<td align="right">卡号</td>
<td>
<input type="text" name="no_num" id="list_no_num" />
</td>
</tr>
<tr id="zj_type" style="display:none;">
<td align="right">证件类型</td>
<td>
<input type="text" name="zj_type" id="list_zj_type"/>
</td>
</tr>
<tr id="zj_num" style="display:none;">
<td align="right">证件号码</td>
<td>
<input type="text" name="zj_num" id="list_zj_num"/>
</td>
</tr>
</table></form>
</td>
</tr>
</table>
</div>
</td>
</tr>
</table>
</tr>
</table>
</body>
</html>
自己運行一下,可以參考一下
<html>
<head>
<script language="javascript" type="text/javascript">
<!-- hide script from old browsers
function msg()
{
// var status = " <% cfg_get("ddns_error"); %>";
//confirm('test 002');
//document.write('hello world.');
return 1;
}
function show_message()
{
setTimeout("self.location.reload();",1000);
//var status = " <% cfg_get("ddns_error"); %>";
// confirm('test 001');
if(msg() == 1)
{
// setTimeout("self.location.reload();",1000);
//setTimeout("window.location.href='test.html'",5000);
// document.write('<b>' + (new Date).toLocaleString() + '</b>');//用来测试是否刷新
}
}
//-->
</script>
</head>
<body >
<input type="button" value="refresh" onClick="show_message();">
<script language="JavaScript">
<!--
// we put this here so we can see something change
document.write('<b>' + (new Date).toLocaleString() + '</b>');
//-->
</script>
</body>
</html> 楼主可以参考上述代码的自动页面刷新功能,这样解决您的问题就简单了
<html><head>
<title>Refresh JavaScript Example</title>
<noscript>
<!--
We have the "refresh" meta-tag in case the user's browser does
not correctly support JavaScript or has JavaScript disabled. Notice that this is nested within a "noscript" block.
-->
<meta http-equiv="refresh" content="2"></noscript><script language="JavaScript">
<!--var sURL = unescape(window.location.pathname);
function refresh()
{
window.location.href = sURL;
}
//-->
</script></head><!--
Use the "onload" event to start the refresh process.
-->
<body onLoad="doLoad()"><script language="JavaScript"><!--
function doLoad()
{
// the timeout value should be the same as in the "refresh" meta-tag
setTimeout( "refresh()", 2*1000 );
}
// we put this here so we can see something change
document.write('<b>' + (new Date).toLocaleString() + '</b>');
-->
</script>
</body></html>