javascript - how to add onload to span - Stack Overflow

I have a function called loadXMLDoc which takes text from the url parameter and sets it inside the para

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
Add a ment  | 

1 Answer 1

Reset to default 3

That'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.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745169969a4614865.html

相关推荐

  • javascript - how to add onload to span - Stack Overflow

    I have a function called loadXMLDoc which takes text from the url parameter and sets it inside the para

    1天前
    30

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信