首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > JavaScript >

js怎样为href赋值?解决办法

2012-03-22 
js怎样为href赋值?js怎样为href赋值?可以这样的吗?form action methodpost namemyforma href

js怎样为href赋值?
js怎样为href赋值?
可以这样的吗?
<form action="" method="post" name="myform">
<a href="" name=links>点击</a>
</form>
<script>
document.myform.links.href="http://www.google.com"
</script>

[解决办法]

HTML code
<form action="" method="post" name="myform" ><a href="" id=links >点击 </a ></form ><script >document.getElementById("links").href="http://www.google.com";</script >
[解决办法]
JScript code
window.onload=function(){   var theLink=document.getElementById("myLink");   theLink.onmouseover=function()   {      this.setAttribute("href","google.com");      this.innerHTML="link to google.com";   }} 

热点排行