| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1791 人关注过本帖
标题:innerhtml引用地址的问题
只看楼主 加入收藏
wstcl
Rank: 1
等 级:新手上路
帖 子:381
专家分:5
注 册:2005-8-17
结帖率:100%
收藏
 问题点数:0 回复次数:0 
innerhtml引用地址的问题
<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>新建网页 1</title>
<script>
function intialhtmleditor(htmleditor)
{
    htmleditor.document.designMode = "on";
        
}

function getinnertext(htmleditor1,htmleditor2,mytxtarea)
{
    htmleditor1.document.body.innerHTML="<img src=\"../aa.jpg\">";
    htmleditor2.document.body.innerText=htmleditor1.document.body.innerHTML;
    mytxtarea.value=htmleditor1.document.body.innerHTML;
    alert(htmleditor1.document.body.innerHTML);
        }
        
</script>


</head>

<body onload="intialhtmleditor(frame1);intialhtmleditor(frame2)">
<form>
<div style=";background-color:#FF00FF">
<iframe id="frame1" style="width:500; height:300;background-color:#FF00FF" ></iframe>
<iframe id="frame2" style="width:500; height:300;background-color:#FF00FF"></iframe>
</div>
<div>
<input type="button" value="
btn1" onclick="getinnertext(frame1,frame2,txt1)">
</div>
<textarea id="txt1"></textarea>
</form>
<p>&lt;&gt;</p>
<img src="../aa.jpg">
</body>

</html>
以上的代码,我第一次在innerHTML中输入了一个相对地址,但运行后,输出innerHTML变成绝对地址,这个怎么解决,我要的效果是如果是输入的是相对地址,输出后仍是相对地址
搜索更多相关主题的帖子: innerhtml 地址 document body div 
2017-12-11 16:02
快速回复:innerhtml引用地址的问题
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.014507 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved