在页面中有一个button和一个选项框,初始选项框设置为不可见,想点击一下button后选项框就变得可见,但是现在点击后没有反应,该怎么办呢?
代码如下:
<script>
function openSkip(){
document.forms[0].stepname.style.display="";
}
</script><td align="center"><html:button property="skip" value="使用跳转审批" onclick="openSkip()"/></td>
<td colspan="2" align="left">
<html:select property="steps" style="display: none">
</html:select>
</td>
这种JS怎么调试呢?
代码如下:
<script>
function openSkip(){
document.forms[0].stepname.style.display="";
}
</script><td align="center"><html:button property="skip" value="使用跳转审批" onclick="openSkip()"/></td>
<td colspan="2" align="left">
<html:select property="steps" style="display: none">
</html:select>
</td>
这种JS怎么调试呢?
或者
document.forms[0].stepname.style.display="block";
function openSkip(){
document.tr1.style.display="";
}
</script>
<tr>
<td align="center"> <html:button property="skip" value="使用跳转审批" onclick="openSkip()"/> </td> </tr>
<tr id="tr1" style="display: none" >
<td colspan="2" align="left">
<html:select property="steps">
</html:select>
</td>
</tr>
<html:select property="steps" style="display: none">
</html:select>
</td> document.getElementById('mytd').getElementsByTagName('select')[0].style.display = 'block';
或者
document.getElementById('mytd').getElementsByTagName('select')[0].style.display = 'inline';
决对好用啊
<%@ page language="java" import="java.util.*" pageEncoding="GBK"%><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>My JSP 'index.jsp' starting page</title>
<script type="text/javascript">
function display(){
var tr1=document.getElementById("tr1");
if(tr1.getAttribute("isshow")=="N"){
tr1.style.display="";
tr1.setAttribute("isshow","Y");
}else{
tr1.style.display="none";
tr1.setAttribute("isshow","N");
}
}
</script>
</head>
<body topMargin='0' leftMargin='0' background="">
<form name=form1 action="">
<table border="1" width="100%" cellPadding=0 cellSpacing=0>
<tr><td><input type="button" value="click" onclick="display()"></td></tr>
<tr id="tr1" isshow="N" style="display:none"><td>12112312312</td></tr>
</table>
</form>
</body></html>
document.forms[0].stepname.style.display=""; 中的“stepname”在哪呢?
应该是“steps”吧,是不是写错了?
function openSkip(){
document.all("steps").style.display="block";
}
</script>
<td align="center"> <input type="button" name="skip" value="使用跳转审批" onclick="openSkip()"/> </td>
<td colspan="2" align="left">
<select name="steps" style="display: none">
</select>
</td>
调JS就乖乖的一步一步的alert
alert("1");
document.forms[0].stepname.style.display="";
}
看进没进这个方法
document.forms[0].steps.style.display="block";
况且搂主写的display="";这里当然不对了 ,应该是block。表示显示 。建议看看css手册。DHTML手册之类的书籍。
document.getElementsByName("steps").style.display="block";
这个比较好,否则的话 就不起作用了.
function showS(){
var dis=document.getElementById("dis");
if(dis.style.display=="block"){
dis.style.display='none';
}else if(dis.style.display=="none"){
dis.style.display='block';
}
}
</script>
function openSkip(){
document.forms[0].tr1.style.display="";
}
function show1(){
document.forms[0].tr1.style.display="none";
}
</script> <body topMargin='0' leftMargin='0' background="" onload = "show1()"> <td align="center"> <html:button property="skip" value="使用跳转审批" onclick="openSkip()"/> </td>
<tr id="tr1" style="display: none" >
<td colspan="2" align="left">
<html:select property="steps" style="display: none">
</html:select>
</td>
</tr>
tbobj2=document.getElementById("tb1");
tbobj2.style.display="none";