Here is an example that works and may help you...
<html>
<head><title>Test Me</title></head>
<script language="Javascript">
function go_to(u,p)
{
var me="<%= "Hello " %>"+p;
alert("User: "+u);
alert("Password: "+me);
}
</script>
<body>
<form name="form" method="POST" action="TestMe.jsp">
<input type=text name=user value="user">
<input type=text name=pass value="pass">
<input type=submit value="Test Me" onClick="go_to(user.value,pass.value)">
</form>
</body>
</html>
Hope this helps,
Todd
>>> [EMAIL PROTECTED] 8/1/00 9:07 >>>
hi Tod ,
Like that it is giving error. It is not coming with that what u sent.
thank you,
regards,
At 07:49 AM 8/1/00 -0400, you wrote:
>That is the Java compiler saying it doesn't understand the variables u and
p because they are Javascript variables and not Java variables. You need to
somehow split the u and p out of your Java code. Maybe like this...
>
>function go_to(u,p) {
>
> <% LoginDao logObj = new LoginDao();
> userId = Integer.parseInt(%>u<%);
> boolean stat = logObj.login(userId,%>p<%);
> %>
>
>I have not done this, but I know that is the problem. Hopefully the above
code will work, but I don't guarantee it.
>
>>>> [EMAIL PROTECTED] 8/1/00 6:48 >>>
>hi all,
> How to convert javascript variables to java variables.
>this is my function
>
>function go_to(u,p) {
>
> <% LoginDao logObj = new LoginDao();
> userId = Integer.parseInt(u);
> boolean stat = logObj.login(userId,p);
> %>
>
>i am getting error given below
>
>Undefined variable: u:userId = Integer.parseInt(u);
>Undefined variable: p:boolean stat = logObj.login(userId,p);
>
>is there any solution to difine u and p.
>
>Thanks in Advance
>
>regards,
>MURALI KRISHNA BALUSA
>VELOCIENT TECHNOLOGIES
>NEW DELHI.
>
>===========================================================================
>To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
JSP-INTEREST".
>Some relevant FAQs on JSP/Servlets can be found at:
>
> http://java.sun.com/products/jsp/faq.html
> http://www.esperanto.org.nz/jsp/jspfaq.html
> http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
> http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
>
>===========================================================================
>To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
JSP-INTEREST".
>Some relevant FAQs on JSP/Servlets can be found at:
>
> http://java.sun.com/products/jsp/faq.html
> http://www.esperanto.org.nz/jsp/jspfaq.html
> http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
> http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
>
>
MURALI KRISHNA BALUSA
VELOCIENT TECHNOLOGIES
NEW DELHI.
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html
http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html
http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets