动态设置href属性为javascript 错误 h1=document.createElement("a");a.innerText="go";h1.setAttribute("href","javascript:myfun()");ie这样是不行的 为什么 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 感觉是一个逗号,和一个分号书写错误.......<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><HTML><head><style type="text/css"></style></head><BODY><script>var h1=document.createElement("a"); h1.innerHTML="go"; h1.setAttribute("href","javascript:myfun()");document.body.appendChild(h1)function myfun(){alert('a')}</script></BODY></HTML> <html><head><meta http-equiv="Content-Type" content="text/html; charset=gb2312"><title>test</title><script>window.onload = function(){ h1=document.createElement("A"); h1.innerText="go"; h1.setAttribute("href","javascript:myfun()"); document.body.appendChild(h1);};function myfun(){ alert("myfun");}</script></head><body></body></html> 晕,IE是这么写的:h1.href="javascript:myfun()" hh=document.createElement("a"); hh.innerText="go";hh.setAttribute("href", "javascript:myfun()");document.body.appendChild(hh);function myfun(){alert("hello");} 有谁知道关于javascript的控件类不 JavaScript怎么控制IE全屏? Extjs 简单问题 但是没整出来 好心的人进来看看吧 在线等 谁帮我解释下这段代码AddEventHandler 如何修改样式 ul li img 第一次写js的作品:自己写的js+xml的树形菜单(IE+FF支持) 该如何实现这样的效果?:向文本框中输入内容时不出现提示, 怎么使图片移动上去就放大? jqueryeasyui 树形节点问题 在netscape下怎样将打印时的页眉页脚去掉?netscape好象没有页面设置 问两个简单的javascript问题 关于级联的问题
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<HTML><head>
<style type="text/css"></style></head>
<BODY><script>
var h1=document.createElement("a");
h1.innerHTML="go";
h1.setAttribute("href","javascript:myfun()");
document.body.appendChild(h1)function myfun(){
alert('a')
}
</script>
</BODY></HTML>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>test</title>
<script>
window.onload = function(){
h1=document.createElement("A");
h1.innerText="go";
h1.setAttribute("href","javascript:myfun()");
document.body.appendChild(h1);
};
function myfun(){
alert("myfun");
}
</script>
</head><body></body></html>
hh=document.createElement("a");
hh.innerText="go";
hh.setAttribute("href", "javascript:myfun()");
document.body.appendChild(hh);
function myfun()
{
alert("hello");
}