我想在a href加载新页面后调用一个函数
<a title="invitation.jpg" target="_blank" class="tabmouserptr filestuffText" href="test.html?hiddenAction=viewfile&fileIndex=5675568">invitation.jpg</a>
Javascript函数需要在加载新页面后表现出色。
FileOpenCount() {
//stuff needed
}
window.onload = function(){
// your code...
};
基本上你可以如上所述使用。
根据您的问题,您可以调用脚本标记中的函数,如
<script type="text/javascript">
FileOpenCount() {
//stuff needed
}
//call the function
window.onload=FileOpenCount;
</script>
试试这个。我想你希望在第二个页面加载完成后,原始页面加载一些东西。单独使用标签是不可能的。但这样做可能会奏效。
"atag".onclick = function() {
// open new browser window like _blank
var win = window.open("test.html?hiddenAction=viewfile&fileIndex=5675568");
// have a reference to the new window so once it's done loading, run my function
win.onload = FileOpenCount
};