js取图片路径的值

来源:互联网 发布:手机网速控制软件 编辑:程序博客网 时间:2024/06/06 08:37

<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=shift_jis">
<title>Page1</title>
<script language=javascript>
function playButton(){
var pic = document.getElementById("picture");
pic.src = "http://www.baidu.com/img/baidu.gif";
}
</script>
</head>

<body>
<body>
<div id="image">
    <img id="picture" class="x"  src=""/>
    <input id="playButton" type="button" onclick="playButton()" value="Play"/>   
</div>
</body>


</body>

</html>

 

 

一般先使用

var a=document.getElementById("sd");

a.src="";

a.width=""