javascript拾掇

用javascript如何给span赋值呢?一般有两种方法:

1>输出html

<body onload="s()">
<span id="hello"></span>

<script language="javascript">
  function s(){
document.getElementById("hello").innerHTML = "<iframe src=  height=400 width=300></iframe>";

}
  </script>

2>输出文本

<body onload="s()">
<span id="hello"></span>

<script language="javascript">
  function s(){
document.getElementById("hello").innerText = "hello world";

}
</script>

http://www.fengfly.com/plus/view-40155-1.html

原文地址:https://www.cnblogs.com/peterpanzsy/p/3679079.html