Problem in Setting Cookie on body onload (frame page)

This is a discussion on "Problem in Setting Cookie on body onload (frame page)" within the JavaScript Forum section. This forum, and the thread "Problem in Setting Cookie on body onload (frame page) are both part of the Program Your Website category.



Go Back   Webforumz.com > Main Forums > Program Your Website > JavaScript Forum

Notices


Reply
 
LinkBack Thread Tools
  #1 (permalink)  
Old Dec 20th, 2005, 10:17
New Member
Join Date: Dec 2005
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Problem in Setting Cookie on body onload (frame page)

Hello,

I have problem in setting 'current page' name thro cookie.

I have web pages comprising of 3 frames (header, leftmenu & mainpage). Now all my main body pages (s1t1p1.html, s2t1p1.html etc) are all include with something like

Code: Select all
<body ... onload="javascript: setCookie('k216cr1','s1t1p1.html')
and in <head> of each page

Code: Select all
function setCookie(name, value) {
var curCookie = name + "=" + escape(value) + ";" ;
document.cookie = curCookie;
}
For some reason, I realised this is not set. The same is working if I use this s1t1p1.html & others as single pages (not part of frame).

Also, works if I put it 'onclick' of each link like (from header, leftmenu etc):

Code: Select all
<a target="mainpage" onclick="setCookie('k216cr1','s1t1p1.html')" href="s1t1p1.html">Name</a>
Will body onload won't work if used within frame? or... can anyone advice me why it was not working & How to fix it?

Thanks
karl

Last edited by sypher; Dec 20th, 2005 at 14:48.
Reply With Quote

  #2 (permalink)  
Old Dec 20th, 2005, 14:47
Most Reputable Member
Join Date: Aug 2005
Location: North Wales, United Kingdom
Age: 21
Posts: 1,093
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to sypher
Re: Problem in Setting Cookie on body onload (frame page)

Ill move this to the javascript forums
Reply With Quote
Reply

Tags
problem, setting, cookie, body, onload, frame, page

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Is the onload event only for <body> tag??? Love2Java JavaScript Forum 7 Jul 30th, 2007 12:44
The frame ruins my page KevinKeegan JavaScript Forum 3 May 21st, 2007 18:46
A gap appears beween the Page Title and the Body Content of the page. sovereign6 Web Page Design 6 Dec 18th, 2006 19:14
setting page length wmw Web Page Design 6 May 22nd, 2006 16:17
problem with Image Object's onLoad function jono JavaScript Forum 2 Jan 10th, 2005 08:10


All times are GMT. The time now is 10:16.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43