the cookie is set during a form submission. an
onclick() function get to invoked and a CookieSet
function is being called,cookie get created then. how
do i grab the cookie in this case? here is the
javascript code and form code.
<script language="JavaScript">
<!--
function CookieSet( name, value, expire )
{
if( document.cookie.length > 4000 )
window.alert( "Your cookie is getting close to 4k"
);
var expDate = new Date();
expDate.setTime( expDate.getTime() + (expire != 0 ?
expire : 0 ) );
document.cookie = name + "=" + escape( value ) + (
expire ? "; expires=" + expDate.toGMTString() + ";":
"") ;
}
function Submit()
{
var name = document.sf.n.value;
var email = document.sf.e.value;
var url = document.sf.u.value;
var description = document.sf.d.value;
var message = document.sf.c.value;
if( name.length == 0 || email.length == 0 ||
url.length == 0 )
{
alert( "Please fill out all neccessary fields!" );
return false;
}
if( email.indexOf( "@" ) == -1 || email.indexOf( "."
) == -1 )
{
alert( "Your e-mail address seems to be invalid.
Please supply a valid e-mail address" );
return false;
}
CookieSet( "name", name );
CookieSet( "email", email );
CookieSet( "url", url );
CookieSet( "description", description );
CookieSet( "message", message );
CookieSet( "ref", document.location.href );
self.document.location.href="stor.php3";
return false;
}
//-->
</script>
<form name=sf>
<table boder=1>
<font size=1>Your name <inputname=n size=40>
<font size=1>Your E-mail address:<input name=e
size=40></td></tr>
<font size=1>URL:</td><td><input name=u
size=40></td></tr>
<font size=1>Subject:</td><td valign=top><input name=d
size=40></td></tr>
<font size=1>Anything else to say? :</td><td><textarea
name=c cols=34
rows=5></textarea>
<input type=button value="Submit your page"
onClick="javascript:Submit();return false;//"></td>
</table>
</form>
TIA
James.Q.L
__________________________________________________
Do You Yahoo!?
Yahoo! Finance - Get real-time stock quotes
http://finance.yahoo.com