erica246
07-22-2003, 11:02 AM
Hello,
I am having troubles passing variables to javascript. I have been doing some research and other sites say to first pass it to a cgi. Can I pass it to java? How? Or is there a way where my code will work? Below is what I currently am using which doesn't work. Any help you can provide me would be great.
In this example if I change the method from post to get it works but then I would have security problems because it is in the URL.
<!-- javauser.htm-->
<html>
<body>
Post by clicking "Submit"
<form method="POST" action="showuser.htm">
<input type="text" name="user_id" size="50">
<input type="submit" name="Submit" value="Submit">
</form>
</body>
</html>
<!--showuser.htm"-->
<script language="JavaScript">
<!--
function showuser(){
valuFromQueryString = window.location.search;
document.write("<html>");
document.write("<head>");
document.write("<title>DCS - Applet</title>");
document.write("</head>");
document.write("<body bgcolor='#C0C0C0'>");
document.write("<p>");
document.write("["+valuFromQueryString+"]");
document.write("</p>");
document.write("</body>");
document.write("</HMTL>");
return false;
}
// End -->
</script>
<html>
<head>
<title>Show User</title>
</head>
<body onload="showuser()">
</body>
</html>
I am having troubles passing variables to javascript. I have been doing some research and other sites say to first pass it to a cgi. Can I pass it to java? How? Or is there a way where my code will work? Below is what I currently am using which doesn't work. Any help you can provide me would be great.
In this example if I change the method from post to get it works but then I would have security problems because it is in the URL.
<!-- javauser.htm-->
<html>
<body>
Post by clicking "Submit"
<form method="POST" action="showuser.htm">
<input type="text" name="user_id" size="50">
<input type="submit" name="Submit" value="Submit">
</form>
</body>
</html>
<!--showuser.htm"-->
<script language="JavaScript">
<!--
function showuser(){
valuFromQueryString = window.location.search;
document.write("<html>");
document.write("<head>");
document.write("<title>DCS - Applet</title>");
document.write("</head>");
document.write("<body bgcolor='#C0C0C0'>");
document.write("<p>");
document.write("["+valuFromQueryString+"]");
document.write("</p>");
document.write("</body>");
document.write("</HMTL>");
return false;
}
// End -->
</script>
<html>
<head>
<title>Show User</title>
</head>
<body onload="showuser()">
</body>
</html>