2017-05-31 98 views
0

下面的代码正在使用谷歌浏览器和Firefox,但不是在Internet Explorer 11上。我有一个图像,我为它创建了一个映射。我尝试了不同的方式来提交表单并调用javascript函数。我注意到,映射只适用于我有一个按钮,但表单提交不起作用。当使用按钮类型=“提交”时,它仍然不提交,但调用了JavaScript函数。Internet Explorer提交表单无效

我想要一个图像的映射,表单将被提交,并且javascript函数将被调用。

<div> 
    <img src="keys.jpg;" height="480" width="640" border="1" usemap="#keysmapping"> 
    <map name="keysmapping"> 

    <form method=GET> 
    <input type="submit" name="key" value="2" onclick="setTimeout('updateImage();',100);"><area class="one" shape="rect" coords="0,0,90,85"></input> 
    </form> 

    <form method=GET> 
    <button type="submit" name="key" value="3" onclick="setTimeout('updateImage();',100);"><area class="two" shape="rect" coords="95,0,195,85"></button> 
    </form> 

    <form method=GET> 
    <input type="text" name="key" value="4"> 
    <button onclick="setTimeout('updateImage();',100);"><area class="three" shape="rect" coords="195,0,290,85"></button> 
    </form> 
    </map> 
</div> 

+1

什么的'updateImage()'函数? – TheDarkKnight

+0

这是我的javascript功能。 <脚本类型= “文本/ JavaScript的”> \t \t 功能updateImage(){ \t IMG =的document.getElementById( 'screenImage'); \t img.src ='screen.jpg?' +的Math.random();” \t} \t – rleenaerts

+0

你确定你已经在'互联网Explorer'设置中启用脚本 – TheDarkKnight

回答

0

尝试2天之后,我找到了一个解决问题的办法。

我认为它必须处理HTML的设计,现在我手动提交表单。

<form method="get" name="myFormOne"> 
     <input type="text" name="key" value="2"> 
     <area alt="One" shape="rect" coords="0,0,95,110" onclick="document.myFormOne.submit();setTimeout('updateImage()',100);"> 
    </form> 

    <form method="get" name="myFormTwo"> 
     <input type="text" name="key" value="3"> 
     <area alt="Two" shape="rect" coords="96,0,210,110" onclick="document.myFormTwo.submit();setTimeout('updateImage()',100);"> 
    </form> 

    <form method="get" name="myFormThree"> 
     <input type="text" name="key" value="4"> 
     <area alt="Three" shape="rect" coords="211,0,310,110" onclick="document.myFormThree.submit();setTimeout('updateImage()',100);"> 
    </form> 
</map>