首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > JavaScript >

急求答案:在ie下可以显示图片,在ff下不行啊解决方案

2012-03-27 
急求答案:在ie下可以显示图片,在ff下不行啊htmlheadMETA HTTP-EQUIVContent-Type CONTENTtext/h

急求答案:在ie下可以显示图片,在ff下不行啊
<html>  
  <head>  
  <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8"/>  
  <title>php</title>  
  <script type="text/javascript">  
  function fun() {  
  var oImg = document.createElement('img');  
  oImg.src = "search02.gif";  
  document.getElementById('hidden').value = oImg.src;  
  document.getElementById('test').appendChild(oImg);  
  }  
  </script>  
  </head>  
  <body>  
  <form name="form1" method="post" action="test.asp">  
  <input type="hidden" id="hidden"/>  
  <textarea name="test" cols="50" rows="20" id="test">ddddddddd</textarea>  
  <input type="button" onClick="fun()" value="fun" id="img">  
  <input type="submit" name="button" id="button" value="link">  
  </form>  
 </body>  
  </html>

[解决办法]
<html>
<head>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8"/>
<title>php </title>
<script type="text/javascript">
function fun() {
var oImg = document.createElement('img');
oImg.src = "http://www.google.cn/images/nav_logo4.png";
document.getElementById('hidden').value = oImg.src;
document.getElementById('test').appendChild(oImg);
}
</script>
</head>
<body>
<form name="form1" method="post" action="test.asp" id="form1">
<input type="hidden" id="hidden"/>
<div contentEditable="ture" name="test" style="width:400px;height:300px;border:1px solid #6699cc" id="test">ddddddddd </div>
<input type="button" onClick="fun()" value="fun" id="img">
<input type="submit" name="button" id="button" value="link">
</form>
</body>
</html>
[解决办法]
可删 可改 操作就是dom操作。
[解决办法]
textarea显示img只有IE做得到,但实际的textarea的value不包含img
要插入img只有用iframe模拟

热点排行