onload function in a PHP file as content of a Tab

I have a tabbar and, for each tab, the content is a PHP file.

In one of these tab I have a form and I would like to excute a javascript function when the tab is opened and the PHP file is loaded.

I used this following code:

<title><? echo $title; ?></title>
<script type="text/javascript">
function XXX() {
<body onLoad="javascript:XXX();">

but the XXX() function is not executed.

Who can help me???

I try this code in the head tag too…but it doesn’t work :smiling_imp:

<script type="text/javascript">
window.onload = function(){

I’ve attached the sample where the second approach is used - the alert appears on load. (34.9 KB)

We used the same code…but in my sample it doesn’t work (36 KB)

I have detect the cause of the problem.

I have the following scripts in the same PHP file:






The conflict is that both the script have a window.onload command. How to fix this problem?

You should place all code in one window.onload handler )