javascript实现对table的显示与隐藏
2011-11-17 11:42
483 查看
<%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*" errorPage="" %>
<!-- Header begin -->
<html>
<head>
<Script Language="JavaScript">
<!--
function getItem() {
var value =SelTest.options[SelTest.selectedIndex].value;
alert(value);
if(value == 1)
{
document.getElementByIdx("select_table1").style.display = "inline";
document.getElementByIdx("select_table2").style.display = "none";
}
if(value == 2)
{
document.getElementByIdx("select_table2").style.display = "inline";
document.getElementByIdx("select_table1").style.display = "none";
}
}
-->
</Script>
<Select name="SelTest" onchange="getItem()">
<option value=""> </Option>
<option value="1">1</Option>
<option value="2">2</Option>
</Select>
<table id = "select_table1" width = "100" border = "0" cellspacing = "0" cellpadding = "0" style = "display:inline">
<tr>
<td bgcolor = "#aabbcc" >table 1</td>
<tr>
</table>
<table id = "select_table2" width = "100" border = "0" cellspacing = "0" cellpadding = "0" style = "display:none">
<tr>
<td bgcolor = "#aabbcc" >table 2</td>
<tr>
</table>
</body>
</html>
<!-- Header begin -->
<html>
<head>
<Script Language="JavaScript">
<!--
function getItem() {
var value =SelTest.options[SelTest.selectedIndex].value;
alert(value);
if(value == 1)
{
document.getElementByIdx("select_table1").style.display = "inline";
document.getElementByIdx("select_table2").style.display = "none";
}
if(value == 2)
{
document.getElementByIdx("select_table2").style.display = "inline";
document.getElementByIdx("select_table1").style.display = "none";
}
}
-->
</Script>
<Select name="SelTest" onchange="getItem()">
<option value=""> </Option>
<option value="1">1</Option>
<option value="2">2</Option>
</Select>
<table id = "select_table1" width = "100" border = "0" cellspacing = "0" cellpadding = "0" style = "display:inline">
<tr>
<td bgcolor = "#aabbcc" >table 1</td>
<tr>
</table>
<table id = "select_table2" width = "100" border = "0" cellspacing = "0" cellpadding = "0" style = "display:none">
<tr>
<td bgcolor = "#aabbcc" >table 2</td>
<tr>
</table>
</body>
</html>
相关文章推荐
- JavaScript里实现显示和隐藏的代码
- JavaScript实现定时隐藏与显示图片的方法
- javascript点击按钮实现隐藏显示切换效果
- javascript 控制 html元素 显示/隐藏实现代码
- 第十二篇 JavaScript(简称JS) 实现显示与隐藏
- BootStrap中Table隐藏后显示问题的实现代码
- javascript实现div的显示和隐藏
- JavaScript实现下拉菜单的显示和隐藏
- JavaScript + jQuery + HTML 实现<input>提示信息的显示、隐藏,功能与jQuery EasyUI的easyui-textbox的prompt属性相同。
- javascript实现显示和隐藏div方法汇总
- 框架页面的实现及Javascript的改变页面显示和隐藏
- javascript实现div的显示和隐藏
- javascript控制点击一次按钮实现元素的显示隐藏
- JavaScript实现显示和隐藏页面中的某个部分
- javaScript实现定时显示隐藏、BOM对象方法介绍、表单简单校验、表格换色、DOM、二级联动
- 基于JavaScript实现表单密码的隐藏和显示出来
- 基于JavaScript实现表单密码的隐藏和显示出来
- javaScript实现定时显示隐藏、BOM对象方法介绍、表单简单校验、表格换色、DOM、二级联动
- javascript实现百度地图鼠标滑动事件显示、隐藏
- javascript实现信息的显示和隐藏如注册页面