关于img的href和src取变量及赋值的方法

时间:2014-04-28    点击:110   

复制代码 代码如下:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
</head>
<a href="#" id="link" title="baidu">
<img id="myself" border="0" src="F:\个人图片\图片\IMG_5605c.jpg" />
</a>
<input type="hidden" name="text10" id="text10" value="http://www.baidu.com"/>
<script type="text/javascript">

document.getElementById("link").href = "http://www.hao123.com/?tn=91001412_s_hao_pg";
document.getElementById("link").href = document.getElementById("text10").value;
document.getElementById("myself").src = "F:\个人图片\图片\IMG_5605c.jpg";
document.write("<h1>Hello World!</h1>")

</script>
<body>
</body>
</html>

目前可以修改href,但src还没有正确,正在研究中,如有知道的伙伴们请留言

IE浏览器中图片onload事件无效的解决方法
javascript的创建多行字符串的7种方法
Javascript实现的常用算法(如冒泡、快速、鸽巢、奇偶等)
当某个文本框成为焦点时即清除文本框内容
JS实现两个大数(整数)相乘
> 返回     
地址:上海市普陀区胶州路941号长久商务中心 电话: QQ:
© Copyright 2012 上海网络 Product All Rights Reserved