Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Dynamically chaning Alternate Style Sheets in Inline Frames

Status
Not open for further replies.

Safacto

Programmer
Feb 10, 2002
15
0
0
GB
Hi,

I wish to be able to allow the user to change the style sheet which the site uses, and make this change work within an IFRAME.

To explain, the site ( has a selector to let the user change to an Alternate Style Sheet. This preference is then saved in a cookie, and used the next time the user visits the site.

However, I have been unable to write a script for which the *.htm documents in the central IFrame can reference this cookie to determine which style sheet to use.

Is there a way of doing this easily??

Cheers,
Richard.
 
try using

var chocchip = parent.document.cookie;

inside the iframe.

I havent tested this and dont know if it works but do know ou can call a function held in the parent document with

parent.myFunction();

so am guessing this will work for cookies too.

good luck

rob
 
Hummm.... I've just tried the parenting you suggest, but the pages in the iframe don't "recognise" the new cookie untill the page is refreshed (i.e. F5). A simple reloading of the iframe doesn't work, the whole page/screen must be refreshed.

Putting a reload() function in is a bit excessive for what I need.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top