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:

<html>
<head>
<title><? echo $title; ?></title>
<script type="text/javascript">
function XXX() {
    YYY;
}
</script>
</head>
<body onLoad="javascript:XXX();">
<form>
    ZZZ
</form>
</body>
</html>

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(){
	alert('hello');
}
</script>

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

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

I have detect the cause of the problem.

I have the following scripts in the same PHP file:

[code]

[/code]

and

[code]

[/code]

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 )