js怎样为href赋值? <form action="" method="post" name="myform" ><a href="" id=links >点击 </a ></form ><script >document.getElementById("links").href="http://www.google.com";</script > 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 window.onload=function(){ var theLink=document.getElementById("myLink"); theLink.onmouseover=function() { this.setAttribute("href","google.com"); this.innerHTML="link to google.com"; }}<a href="baidu.com" id="myLink">link to baidu.com</a>==============================================也可以用這種方法。關鍵字:setAttribute. 请教 必填项怎么弄?以下是我的代码,怎么弄成所有的题都做完才能提交,不然会提示 题未答完 求教 js loop问题 用过 simpleHTMLTree 的朋友请进! 自己的网站按会员统计广告联盟的广告 如何给新增dom元素 套用jquery ui的autocomplete控件 下拉菜单被列表框挡住了,请问有没有解决办法? 在线等待,立马结贴,关于IFRAME的字体设置 有关菜单问题,在线等待,谢谢!!! 谁知道哪里有用JScript做的“日期时间控件”?要源码! 求一个小数算整数的一段js 谢谢 IE6与IE7问题
window.onload=function()
{
var theLink=document.getElementById("myLink");
theLink.onmouseover=function()
{
this.setAttribute("href","google.com");
this.innerHTML="link to google.com";
}
}
<a href="baidu.com" id="myLink">link to baidu.com</a>==============================================
也可以用這種方法。關鍵字:setAttribute.