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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

onClick help with frames

Status
Not open for further replies.

randyQ

IS-IT--Management
Apr 26, 2001
117
US
I am trying to do a very simple command that let my viewers click on a link that changes the scrollbars to a designated color. I am using three frames, with the links in the top frame, and the affected scrollbars are on the left and right frames, under the top frame. The script I am using works, but only on the main page (right frame) and the navigation page (left frame). When I navigate to a differnt page, the main frame (right) scrollbar colors are lost, and only the navigation bar colors remain, and are still changeable via the links on the left. Here is my URL, so you can see exactly whats going on:
I am thinking that the problem exists because the other pages are in a subfolder, and not in the main index folder (faithmessages).

After viewing my script source, can anyone tell me what I need to do to make the script work on all of my pages?
 
I dont think what you are trying to do can work with frames [soapbox]
sleep is good
 
you can keep a variable in your parent frame that keeps track of the current frame color. Then you can have an onLoad event on the body of each page that loads into your right frame that reads that variable and sents its scroll bar(s) to that color.

cheyney
 
I found my problem, but encountered a new one. the problem was solved by me putting my parameter back into the function definition. That allowed my other pages to load the new color codes for the scrollbars.

Clarification before I continue:
top frame name (constant, never changes)=TitleFrame
left frame name (constant, never changes)=NavigationFrame
right frame name(dynamic, new pages load here)=ContentFrame

Now, whenever I click on a link, the ContentFrame loses the scrollbar variable, and reverts back to the IE default. How can I carry that color variable into the new page? Keep in mind that for the most part, I am calling these new pages from the NavigationFrame.

Here is the code I use in my TitleFrame <head> tag:
<script>
var C1 = '#FF0000'
var C2 = '#00FF00'
var C3 = '#0000FF'
var C4 = '#FF8000'
var C5 = '#FFFF00'
var C6 = '#C0C0C0'
function changeScrollbarColor(C){if (document.all){document.body.style.scrollbarBaseColor = C}}
</script>

then to call the changes, I put 6 of these href's into the <body> tag

<a href=&quot;javascript:changeScrollbarColor(C1)&quot; target=&quot;NavigationFrame&quot; onClick=&quot;parent.ContentFrame.location='javascript:changeScrollbarColor(C1)'&quot;>

<a href=&quot;javascript:changeScrollbarColor(C2)&quot; target=&quot;NavigationFrame&quot; onClick=&quot;parent.ContentFrame.location='javascript:changeScrollbarColor(C2)'&quot;>

<a href=&quot;javascript:changeScrollbarColor(C3)&quot; target=&quot;NavigationFrame&quot; onClick=&quot;parent.ContentFrame.location='javascript:changeScrollbarColor(C3)'&quot;>
etc.

I have the same script redefined in each of the page's <head> tags, but everytime I load a new page into the ContentFrame, the scrollbars lose their color. I can reclick on the href's to get teh color back, but I want the color to stay constant when a new page is loaded. How do I carry the last variable used into the new page that is being loaded? I think the onLoad will do this, but how do I call the last variable used?
 
Here's the URL to my page, so you can view the script and maybe get a better idea of how to help me out. Just change the color by clicking on one of the links in the top frame, then click on a link on the left frame to see how the right frame drops the custom colors. Thanks all, in advance.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top