想实现一个效果就是 图片按钮 做提交按钮 并且当敲击回车键的时候提交
实现方法及步骤如下:
<input type=image
id="imgbutton"
src="your img url"
style="cursor: hand"
οnclick="submitForm()"
>
js:
function enterKeySubmit(evnt)
{
var witch_key = (navigator.appname=="Nwtscape")?evnt.which:evnt.keyCode;
if (witch_key == 13)//回车键默认是13
{
document.getElementById('imgbutton').focus();
submitForm();
}
}
function submitForm(){ document.myform.action="http://www.baidu.com";
}
实现方法及步骤如下:
<input type=image
id="imgbutton"
src="your img url"
style="cursor: hand"
οnclick="submitForm()"
>
js:
function enterKeySubmit(evnt)
{
var witch_key = (navigator.appname=="Nwtscape")?evnt.which:evnt.keyCode;
if (witch_key == 13)//回车键默认是13
{
document.getElementById('imgbutton').focus();
submitForm();
}
}
function submitForm(){ document.myform.action="http://www.baidu.com";
}