欢迎来到代码驿站!

JavaScript代码

当前位置:首页 > 网页前端 > JavaScript代码

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

时间:2021-04-27 09:10:42|栏目:JavaScript代码|点击:

复制代码 代码如下:

<!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还没有正确,正在研究中,如有知道的伙伴们请留言

上一篇:js 数组操作代码集锦

栏    目:JavaScript代码

下一篇:js实例入门(简单展开或关闭)

本文标题:关于img的href和src取变量及赋值的方法

本文地址:http://www.codeinn.net/misctech/110101.html

推荐教程

广告投放 | 联系我们 | 版权申明

重要申明:本站所有的文章、图片、评论等,均由网友发表或上传并维护或收集自网络,属个人行为,与本站立场无关。

如果侵犯了您的权利,请与我们联系,我们将在24小时内进行处理、任何非本站因素导致的法律后果,本站均不负任何责任。

联系QQ:914707363 | 邮箱:codeinn#126.com(#换成@)

Copyright © 2020 代码驿站 版权所有