位置更换一下,<span>还没有加载呢<span id="Result1"/>
<span id="Result2" /><script type="text/javascript">function OnLoad()
{
document.getElementById("Result1").innerText="AAA";
document.getElementById("Result2").innerText="BBB";
}
window.onload=OnLoad;
</script>
<span id="Result2" /><script type="text/javascript">function OnLoad()
{
document.getElementById("Result1").innerText="AAA";
document.getElementById("Result2").innerText="BBB";
}
window.onload=OnLoad;
</script>
解决方案 »
- JavaScript 如何实现页面既有的数据的排序.
- 表单判断问题
- 请问SAAS平台是用什么语言开发的?
- jquery和ajax在安卓设备的浏览器下会失效吗
- 如何动态的在sum显示来年两个input的和?急!在线等!
- 总是没有搞明白的问题
- 在JavaScript中,嵌入以下ASP语句,为何显示的菜单项中多了一个问号?加急!!在线等!
- 在网页的中插入打字效果(急!)
- 进来看看吧。
- 用JavaScript在Frame[0]中访问Frame[1]页面Form元素,如果Frame[1]与Frame[0]同一WebServer没有问题,如果不是同一WebServer,就会报“拒绝访问”。请问,有办法解决吗?
- window.document.execCommand("SaveAs",false,id+".xls"); 在IE7下的问题
- js
<span id="Result2" /><script type="text/javascript">function OnLoad()
{
document.getElementById("Result1").innerText="AAA";
document.getElementById("Result2").innerText="BBB";
}
window.onload=OnLoad;
</script>
<span id="Result2" /><script type="text/javascript">function OnLoad()
{
document.getElementById("Result1").innerText="AAA";
document.getElementById("Result2").innerText="BBB";
}
window.onload=OnLoad;
</script>
<script type="text/javascript">function OnLoad()
{
document.getElementById("Result1").innerText="AAA";
document.getElementById("Result2").innerText="BBB";
}
window.onload=OnLoad;
</script><span id="Result1"></span>
<span id="Result2"></span>
<span id="Result2"></span>
1楼正解,JS是解释型语言,在span未载入前是不能对其操作的