js通过获取id和name改变图片
2012-07-31 11:29
609 查看
<html> <head> <script type="text/javascript"> <!-- function one(){ document.getElementById('ok').style.background='url(http://d.lanrentuku.com/down/png/1205/angrybirds.jpg)'; } function two(){ document.getElementById('ok').style.background='url(http://d.lanrentuku.com/down/png/1110/angry_birds.jpg)'; } function first(){ document.yes.src='http://d.lanrentuku.com/down/png/1205/angrybirds.jpg'; } function second(){ document.yes.src='http://d.lanrentuku.com/down/png/1110/angry_birds.jpg'; } //--> </script> </head> <body> <div id="ok" onMouseover="one()" onMouseout="two()" style="height:150px;width:550px;border:1px solid #ccc;background:#ddd">通过获取id变换</div> <hr /> <a href="#"> <img src="http://www.baidu.com/img/baidu_jgylogo3.gif" name="yes" onmouseOver="first()" onmouseOut="second()" border="0" /> </a> </body> </html>
相关文章推荐
- js获取封装对象/通过id tag className
- jquery通过id或name获取标签的值,以及简单的js正则表达式
- JS原生通过id,class,tagname 来获取元素的方法
- jquery通过id或name获取标签的值,以及简单的js正则表达式(笔记)
- js之checkbox的代码全选/全不选,使用id获取元素,而不是name
- iOS 直接改变.html后缀的链接所对应的html页面样式,并获取html的标题,图片地址,id,内容
- js中用tagname和id获取元素的3种方法
- 【Res id】通过图片名称获取资源图片
- 通过drawable下的图片名获取图片的id
- 进击的KFC:iOS WebView 如何通过js获取网页中所有图片并加入点击事件,实现浏览图片的功能
- 通过js获取上传的图片信息(临时保存路径,名称,大小)然后通过ajax传递给后端的方法
- JS获取网页图片name属性的方法
- 通过产品ID或者SKU获取产品相关信息(ShortDescription、Name、Price、ProductUrl、ImageUrl)
- web开发设计--JS学习之通过ID获取元素
- 如何通过js和jquery获取图片真实的宽度和高度
- JS小Demo实战之通过获取文本框的输入值来改变div的类型
- iOS WebView 如何通过js获取网页中所有图片并加入点击事件,实现浏览图片的功能
- js querySelector和getElementById通过id获取元素的区别
- jQuery Validate 表单验证插件----通过name属性来关联字段来验证,改变默认的提示信息,将校验规则写到 js 代码中
- jquery通过id或name获取radio选中值