views:

41

answers:

2

Hi,

problem in javascript validation , how to make call to javascript ?

<html> 
<head> 
<script type='text/javascript'> 
function validate() 
{ 
alert('hi'); 
} 
</script>
</head> 
< body> 
 <ice:panelGrid> 
 <ice:inputText/> 
..... 
... 
... 
</ice:panelGrid> 
<ice:commandButton onclick="validate();"/> 
</body> 
</html> 

I am not able to access the javascript.Getting error as validate not defined.

same if defin is onClick="alert('hi');" this alert message is working well.

So what changes should i do the invoke javascript ?

A: 

Put an end </script> tag.

<script type='text/javascript'> 
    function validate() 
    { 
        alert('hi'); 
    } 
</script>
Randall Kwiatkowski
I think it was just a red herring. The OP edited too much away from the code snippet. The lack of a closing `</script>` would namely rather have produced a blank page because everything goes in `<script>`.
BalusC
I missed here only, not in the code...
Leena
A: 

I'd advise for double-quotes:

<script type="text/javascript"> 
Bozho