javascript拾掇

时间:2023-03-09 03:03:05
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