87,997
社区成员




function clickSearch(e)
{
var currKey=0,e=e||event;
currKey=e.keyCode||e.which||e.charCode;
if(currKey==13)
{
//dosomething
}
}
var comment = document.getElementById("aaa");
if (document.all) {
// For IE
comment.click();
} else if(document.createEvent) {
//FOR DOM2
alert("进来了!");
var ev = document.createEvent("MouseEvents");
ev.initEvent("click", true, true);
comment.dispatchEvent(ev);
}
<a id="ref" onclick="showClick()">...</a>
<script type="text/javascript">
function showClick()
{
alert("ok")
location.href='http://dotnet.aspx.cc'
}
window.onload=function()
{
document.getElementById("ref").onclick();
}
</script>
function a(ev){
var ev=window.event||ev;
if (ev.ctrlKey && ev.keyCode==13){
alert('按下了ctrl+回车');
}
}