JavaScript Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingJavaScript Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old January 18th, 2005, 11:11 AM
sewage sewage is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Posts: 50 sewage User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 22 m 35 sec
Reputation Power: 5
javascript in frames

I have a page using frames in order to give the ability to have music played uninterrupted through out the navigation of the site. The music is located in music.html and I have buttons in main.html that I want to be able to turn the music off.

Code:
   <FRAMESET rows="1,*" FRAMESPACING="0" BORDER="0">
 		<FRAME SRC="music.html" NAME="top" marginwidth="0" marginheight="0" scrolling="no" frameborder="no" noresize>
 		<FRAME SRC="main.html" NAME="main" marginwidth="0" marginheight="0" scrolling="yes" frameborder="no" noresize>
  
   
   <noframes>
  
   main page content
   buttons here
   </noframes>
  



this is the javascript that I had before I added frames to the site

Code:
   <script>
 						function EvalSound(soundobj) {
 				 var thissound=document.getElementById(soundobj);
 						 thissound.Play();
 						 
 						}
 						
 						function EvalSound2(soundobj) {
 				 var thissound=document.getElementById(soundobj);
 						 thissound.Stop();
 						}
 						</script>
  
   


this is my buttons
Code:
   <form>
 						<input id="1" type="button" onClick="EvalSound('song')">
 						<input id="2" type="button" onClick="EvalSound2('song')">
 						</form>
  
   


how should I change this script so that it will work with frames, where should I put the script too?

Reply With Quote
  #2  
Old January 18th, 2005, 11:20 PM
sewage sewage is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Posts: 50 sewage User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 22 m 35 sec
Reputation Power: 5
nevermind, I was able to get it to work by changing the line in the script from

Code:
  var thissound=document.getElementById(soundobj);
  
  


to

Code:
   var thissound= parent.top.document.getElementById(soundobj);
  

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingJavaScript Development > javascript in frames


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 | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway
Stay green...Green IT