日期:2014-05-16  浏览次数:20353 次

急求答案:在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模拟