You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Anuradha S.Athreya" <an...@world2web.com> on 2005/08/29 10:55:59 UTC

Passing variable to javascript function

I had posted this problem a few days back, but I couldn't find a solution to
this.
So I'm posting this again, since I need to implemen this urgently.

> <script>
> function validateDelete()
> {
> 	return confirm("Delete Data");	
> }
> </script>	
> 
> 
> 	<html:link action="deleteData" name="deleteDataParams" scope="page"
> onclick="return validateDelete()" >
>       				Delete Data 
>       			</html:link>
> 
> 	To the validateDelete() Javascript function, I want to pass a java
> variable. How do I do it? 
> 	Once I pass the variable, my javascript function has to be :
> 
> 		<script>
> function validateDelete(data)
> {
> 	return confirm("Delete Data"+data);	
> }
> </script>