calling javascript function when my jsp is loaded

thumbnail
4620263, modificat fa 16 anys. Regular Member Apunts: 126 Data d'incorporació: 17/02/10 Publicacions recents
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, modificat fa 16 anys. Liferay Legend Apunts: 1744 Data d'incorporació: 06/11/08 Publicacions recents
Hi,

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


Regards,
Sandeep
thumbnail
4620263, modificat fa 16 anys. Regular Member Apunts: 126 Data d'incorporació: 17/02/10 Publicacions recents
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