javascript问题
有一个JAVASCRIPT函数
function onCheck(){
if(document.getElementById("checKForm1").style.display=="none")
{
document.getElementByName("hasCheck").value=1;
}
else
{
document.getElementByName("hasCheck").value=0;
}
}
<input name="hasCheck" type="hidden" id="hasCheck"/>
<input type="button" value="填写开票" onclick="onCheck()" name="openCheck" style="width:100px"/>
提交表单后那个hasCheck没有数值,空的
后台我是用
String hasCheck=request.getParameter("hasCheck");
有没有人解释一下呢?
你确定JS 没出错?
我记得方法是
document.getElementByName("hasCheck").value=1;
document.getElementsByName
你的前台的那个hanCheck有值吗????
<input name="hasCheck" type="hidden" id="hasCheck"/>
前提唉就是这样,没有默认值
getElementByName 没有这个方法的 改成 getElementById
点的时候看看浏览左下角是不是出现感叹号了,如果太快了没发现的话,就先不要提交,比如:return false;
document.getElementByName("hasCheck").value=1;
document.getElementsByName
document.getElementByName("hasCheck")
相关问答:
三个数x,y,z 比大小..
var x,y,z,t;
if (x>y)
{t=x;x=y;y=t;} //交换x,y的值
if(x>z)
{t=z;z=x;x=t;}//交换x,z的值
if(y>z)
{t=y;y=z;z=t;}//交换z,y的值
这是 ......
我的源文件如下:
<html>
<head> <title>show picture </title>
<script>
function change(fileName)
{
  ......
我也来一个趣味javascript:
打开以下html文件,依次按下G,L,C三个键,就会有奇迹出现!!
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" ......
设有众多div层 希望点击到那个层,就获得那个层的id
问题是 我想把id转换成一个可以alert的数字
因为我需要这个数字来确定数组中的某一项
例如
我定义某个div的id为e1
点击他后 与之对应的数组aaa[1]中的数据返 ......
jsp页面1中:
我定义了一个变量flag
<script language="javascript"> var flag=1;</script>
jsp页面2中:
在此页面中想获取flag这个变量
<% String flag=request.getParameter(" ......