No you can't just access a Javascript method from JSP.  JSP knows nothing about Javascript.   But you can use JSP to print out Javascript methods on the fly.
    By the way.  To print to the webpage it is out.println.  Not System.out.println
-----Original Message-----
From: A mailing list about Java Server Pages specification and reference [mailto:[EMAIL PROTECTED]]On Behalf Of Veena
Sent: Sunday, January 17, 1999 8:40 AM
To: [EMAIL PROTECTED]
Subject: How to access a JAVASCRIPT method within JSP

Hi all
 
can i access a javascript method within jsp...............
 
what i mean to say is can i do something like this..
the code below is not working....So is there any alternative to do this..........
 
code is as follows...........
 
<html>
<%! int x=10; %>
<%! int y=20; %>
<%! int z; %>
<% z=addnos(x,y) %>
<% System.out.println("the sum is :"+z); %>      
 
<head>
<SCRIPT LANGUAGE="javascript">
 function addnos(var a,var b) {
 var c=a+b;
 return c;
}
</SCRIPT>
</head>
</html>
 
Thanks & Bye
KJV
 

Reply via email to