将区域js变量映射到输入中的php

时间:2019-02-26 16:50:46

标签: javascript php

我有一个密码。同时,我想发送ell(x)(0,1,2,3)的值和php变量。

有人可以帮我吗?

</script>

function ell(er) {

  document.getElementById("szgep2").submit();
}
</script>

<form name="szgep2" id="szgep2" action="k.php" method="post"  />
<center>
<MAP name="wordkep">
<AREA SHAPE="circle" COORDS="11,61,8"  TITLE="" href="#" onclick="ell(0)"/>
<AREA SHAPE="circle" COORDS="34,61,8"  TITLE="" href="#" onclick="ell(1)"/>
<AREA SHAPE="circle" COORDS="58,61,8"  TITLE="" href="#" onclick="ell(2)"/>
<AREA SHAPE="circle" COORDS="82,61,8"  TITLE="" href="#" onclick="ell(3)"/>

</MAP><img src="szamegy/1_12.jpg"  usemap="#wordkep" >  

    <input type="hidden" name="menusor" value='.$menusor.'> 
    <input type="hidden" name="hosz" value='.$hosz.' >

    <input type="submit" value=" Következő "  name="sb1"  hidden="hidden"/></form> </div>' ;
    ?>

1 个答案:

答案 0 :(得分:0)

尝试一下:

<script>
function ell(er) {
  document.getElementById("ell").value = er;
  //store the value in a hidden field before submitting
  document.getElementById("szgep2").submit();
}
</script>

<form name="szgep2" id="szgep2" action="k.php" method="post"  />
  <MAP name="wordkep">
    <AREA SHAPE="circle" COORDS="11,61,8"  TITLE="" href="#" onclick="ell(0)"/>
    <AREA SHAPE="circle" COORDS="34,61,8"  TITLE="" href="#" onclick="ell(1)"/>
    <AREA SHAPE="circle" COORDS="58,61,8"  TITLE="" href="#" onclick="ell(2)"/>
    <AREA SHAPE="circle" COORDS="82,61,8"  TITLE="" href="#" onclick="ell(3)"/>
  </MAP>
  <img src="szamegy/1_12.jpg"  usemap="#wordkep" >  
  <input type="hidden" name="ell" value="" id="ell"> 
  <input type="hidden" name="menusor" value='.$menusor.'> 
  <input type="hidden" name="hosz" value='.$hosz.' >
  <input type="submit" value=" Következő "  name="sb1"  hidden="hidden"/>
</form>