HTML gevorderde |
|
Is het mogelijk om een javascript variabele in JSP of PHP te gebruiken?
Ik wil namelijk de inhoud van een invoerveld in de session zetten, zonder het formulier te versturen.
Dit is trouwens de code die ik nu heb... misschien dat dat het probleem verduidelijkt (dit is dus JSP):
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML>
<HEAD>
<TITLE>ESA-project</TITLE>
<LINK rel="stylesheet" href="/style.css" type="text/css">
<SCRIPT type="text/javascript" language="javascript">
function openMain()
{
setSes(document.frm.pass.value);
theURL = "/Frames/servlet/dispatcher?function=Login";
window.open(theURL, "Main", "width=1000,height=700,scrollbars=no,toolbar=no,location=no,status=no,menubar=no,directories=no,toolbar=no,resizable=no");
}
function openMain2(val)
{
setSes(val);
theURL = "/Frames/servlet/dispatcher?function=Login";
window.open(theURL, "Main", "width=1000,height=700,scrollbars=no,toolbar=no,location=no,status=no,menubar=no,directories=no,toolbar=no,resizable=no");
}
function setSes(val);
{
<%
HttpSession ses = request.getSession();
ses.setAttribute("pass", /* -> val <- */ );
%>
}
</SCRIPT>
</HEAD>
<BODY <% if (request.getParameter("pass") != null)
out.print("onload=openMain2('"+request.getParameter("pass")+"')"); %> >
<BR>
<TABLE border="1" cellpadding="0" cellspacing="0" summary="table" class="frame">
<TR>
<TD align="center" valign="top">
<BR>
<H1><FONT face="Times New Roman" size="7" color="#FFFFFF">ESA Project</FONT></H1>
<BR>
<FORM name="frm">
<FONT color="#FFFFFF">This is a secured area, please insert password:</FONT><BR><BR>
<INPUT type="password" name="pass" value="nodorus"><BR><BR>
<INPUT type="button" value="Start Application" onclick="openMain()">
</FORM>
</TD>
</TR>
</TABLE>
</BODY>
</HTML>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <HTML> <HEAD> <TITLE>ESA-project</TITLE> <LINK rel="stylesheet" href="/style.css" type="text/css"> <SCRIPT type="text/javascript" language="javascript"> function openMain() { setSes(document.frm.pass.value); theURL = "/Frames/servlet/dispatcher?function=Login"; window.open(theURL, "Main", "width=1000,height=700,scrollbars=no,toolbar=no,location=no,status=no,menubar=no,directories=no,toolbar=no,resizable=no"); } function openMain2(val) { setSes(val); theURL = "/Frames/servlet/dispatcher?function=Login"; window.open(theURL, "Main", "width=1000,height=700,scrollbars=no,toolbar=no,location=no,status=no,menubar=no,directories=no,toolbar=no,resizable=no"); } function setSes(val); { <% HttpSession ses = request.getSession(); ses.setAttribute("pass", /* -> val <- */ ); %> } </SCRIPT> </HEAD> <BODY <% if (request.getParameter("pass") != null) out .print("onload=openMain2('"+request .getParameter ("pass")+"')"); %> > <BR> <TABLE border="1" cellpadding="0" cellspacing="0" summary="table" class="frame"> <TR> <TD align="center" valign="top"> <BR> <H1><FONT face="Times New Roman" size="7" color="#FFFFFF">ESA Project</FONT></H1> <BR> <FORM name="frm"> <FONT color="#FFFFFF">This is a secured area, please insert password:</FONT><BR><BR> <INPUT type="password" name="pass" value="nodorus"><BR><BR> <INPUT type="button" value="Start Application" onclick="openMain()"> </FORM> </TD> </TR> </TABLE> </BODY> </HTML>
|