admin管理员组文章数量:1414620
I have a function called loadXMLDoc which takes text from the url parameter and sets it inside the parameter name of another page that has the same span name. im trying to use onload to make it into one line by using onload instead of having it in 2 lines.
<span id="span number1" onload="loadXMLDoc('www.url','span number1')"></span>
I have a function called loadXMLDoc which takes text from the url parameter and sets it inside the parameter name of another page that has the same span name. im trying to use onload to make it into one line by using onload instead of having it in 2 lines.
<span id="span number1" onload="loadXMLDoc('www.url.','span number1')"></span>
<span id="span number1"></span>
<script> loadXMLDoc("www.url.","span number1");</script>
Share
Improve this question
asked Feb 12, 2015 at 15:01
Safi NaseenSafi Naseen
1231 gold badge2 silver badges4 bronze badges
1 Answer
Reset to default 3That's not possible. onload
works only on external resources (images, frames, ...) and the body itself.
Depending on your page structure you could add onload="loadXMLDoc('www.url.','span number1')"
to the <body>
tag. Otherwise your second example looks correct and should also work.
本文标签: javascripthow to add onload to spanStack Overflow
版权声明:本文标题:javascript - how to add onload to span - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745169969a2645914.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论