So to recap, one of the external pages you're fetching via Ajax contains a BODY onLoad event with code you want to run when that page is added to the Ajax Tabs Content area right? If so, in many cases, you can get away with just using the script's "onajaxpageload" event handler to detect when that page has been successfully fetched, and fire the desired code(s) on the main page instead. For example, in the below example, when the user clicks on the 2nd tab, the script fires some JavaScript when the page is fetched:
Code:
<ul id="countrytabs" class="shadetabs">
<li><a href="tab.htm" rel="countrycontainer" class="selected">Tab 1</a></li>
<li><a href="tab2.htm" rel="countrycontainer">Tab 2</a></li>
<li><a href="tab3.htm" rel="countrycontainer">Tab 3</a></li>
</ul>
<div id="countrydivcontainer" style="border:1px solid gray; width:450px; margin-bottom: 1em; padding: 10px">
</div>
<script type="text/javascript">
var countries=new ddajaxtabs("countrytabs", "countrydivcontainer")
countries.setpersist(true)
countries.setselectedClassTarget("link") //"link" or "linkparent"
countries.init()
countries.onajaxpageload=function(pageurl){
if (pageurl.indexOf("tab2.htm")!=-1){
//run code that normally would be assigned to tab2.htm's body onload event handler
}
}
</script>
Bookmarks