Derek_24
07-23-2003, 07:48 PM
Hello. Does anyone know how to reference a text box object in a Javascript cookie? I thought maybe take the ID of the object and somehow add it to the cookie, but what I tried below failed. I want to grab the value of what was entered into the text box through a popup window. Below is the code:
<INPUT TYPE="button" NAME="define" VALUE="View all profiles" onClick="view()">
<INPUT ID="search" INPUT TYPE="TEXT"
NAME="search">
<Script Language="JavaScript">
// tried to get ID of the above object called search.
var search = document.getElementById(search);
function view()
{
strCookie = "search=" + escape(search);
//send the cookie
document.cookie = strCookie;
//open up new window
var windowView = window.open('popup.jsp','view','width=600,height=600');
}
</Script>
<INPUT TYPE="button" NAME="define" VALUE="View all profiles" onClick="view()">
<INPUT ID="search" INPUT TYPE="TEXT"
NAME="search">
<Script Language="JavaScript">
// tried to get ID of the above object called search.
var search = document.getElementById(search);
function view()
{
strCookie = "search=" + escape(search);
//send the cookie
document.cookie = strCookie;
//open up new window
var windowView = window.open('popup.jsp','view','width=600,height=600');
}
</Script>