JavaScript Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsWeb DesignJavaScript Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old April 24th, 2003, 06:34 AM
Neildadon Neildadon is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2002
Posts: 12 Neildadon User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
javascript changing other frames background color

can anyone help please

i have 4 frames on my page. in one of my frames i have designed a background modificator you select a color from the selection list and when the button to change color is clicked it changes to the selected color. What im now trying to do is add an extra option in where the user can select which frame to change the background too. this is where ive come to a problem does anyone have a solution ?

many thanks

Reply With Quote
  #2  
Old April 24th, 2003, 08:13 AM
degsy degsy is offline
Contributing User
Dev Shed Intermediate (1500 - 1999 posts)
 
Join Date: Nov 2001
Posts: 1,882 degsy User rank is Sergeant (500 - 2000 Reputation Level)degsy User rank is Sergeant (500 - 2000 Reputation Level)degsy User rank is Sergeant (500 - 2000 Reputation Level)degsy User rank is Sergeant (500 - 2000 Reputation Level)degsy User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 5 Days 21 h 19 m 30 sec
Reputation Power: 18
To change the current page
Code:
<p><a href="javascript:" onclick="document.body.bgColor='red'">Change This Frame</a></p>



To change a frame you have to reference the frame name
Code:
<p><a href="javascript:" onclick="parent.mainFrame.document.body.bgColor='blue'">Change That Frame --></a></p>

Reply With Quote
  #3  
Old April 24th, 2003, 09:45 AM
adios adios is offline
Senior Citizen
Dev Shed Regular (2000 - 2499 posts)
 
Join Date: Jan 2001
Location: leftcoast
Posts: 2,019 adios User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 15
<form>
Change
<select name="frame">
<option value="self">This</option>
<option value="left">Left</option>
<option value="right">Right</option>
<option value="bottom">Bottom</option>
</select> frame to
<select name="colors">
<option value="tan">Tan</option>
<option value="olive">Olive</option>
<option value="coral">Coral</option>
<option value="peru">Peru</option>
<option value="orange">Orange</option>
</select> background
<input type="button" value="now" onclick="docolor(frame,colors)">
</form>

function docolor(frame_sel, color_sel) {
var frame = frame_sel.options[frame_sel.selectedIndex].value;
var color = color_sel.options[color_sel.selectedIndex].value;
var obj = (frame == 'self') ? window : top;
obj[frame].document.body.style.background = color;
}

This assumes frames named 'left', 'right', 'bottom', and the one the code is written into. Untested.

Reply With Quote
Reply

Viewing: Dev Shed ForumsWeb DesignJavaScript Development > javascript changing other frames background color

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap