页面加载后运行javascript

Ben*_*min 6 javascript jquery pageload

setup_account ui-mobile-viewport ui-overlay-c

当我创建的页面加载如下:

var location    =   location.href+"&rndm="+2*Math.random()+" #updatecomment0>*"
$("#updatecomment0").load(location, function(){});
Run Code Online (Sandbox Code Playgroud)

我有多个脚本运行updatecomment0 div:

<div id="updatecomment0">
    <div id="javascript1">hi</div>
    <div style="float:right;" class="javascript2">delete</div>
</div>
Run Code Online (Sandbox Code Playgroud)

我不知道如何页面加载运行其他JavaScripts .
有人可以告诉我如何使用它.
谢谢

Che*_*tan 12

使用 $(document).ready().


Sre*_*r P 5

使用jQuery,你可以很容易地做到这一点.

jQuery(document).ready(function(){
    alert('Your DOM is ready.Now below this u can run all ur javascript');
});
Run Code Online (Sandbox Code Playgroud)