calling javascript function when my jsp is loaded

thumbnail
4620263, modified 16 Years ago. Regular Member Posts: 126 Join Date: 2/17/10 Recent Posts
I want to call a javascript function on load page
well I tried this:



and:

<script type="text/javascript">
window.onload=charger(){alert("coucou");}
</script>


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


<script type="text/javascript"> 
window.onload=charger; 
function charger(){ 
	alert("coucou"); 
} 
</script>


But nothing works.
thanks in avance.
thumbnail
1545856, modified 16 Years ago. Liferay Legend Posts: 1744 Join Date: 11/6/08 Recent Posts
Hi,

Try this
<script type="text/javascript">
jQuery(document).ready(function() {
   alert("san-d");
});	
</script>


Regards,
Sandeep
thumbnail
4620263, modified 16 Years ago. Regular Member Posts: 126 Join Date: 2/17/10 Recent Posts
thanks
but it does not work may be because I have al older version :I use liferay 4.2
I guess jquery is available since liferay 4.3