Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

JavaScript Forum


You are currently viewing our JavaScript Forum as a guest. Please register to participate.
Login



Reply
radio station selection
Old 01-14-2009, 08:21 AM radio station selection
Junior Talker

Posts: 4
Name: clyght malundras
Trades: 0
hello..

just wanna ask for what codes should use..

i have radio on my website

here is the code.
PHP Code:
<object type="video/x-ms-wmv" data="http://eradioportal.com/energyfm-metromanila.asx" width="100%" height="64">
<
param value="1" name="ShowStatusBar">
<
param value="1" name="enableContextMenu">
<
param value="http://eradioportal.com/energyfm-metromanila.asx" name="src">
<
param value="1" name="autostart">
<
param value="0" name="volume"></object
i have a list of links of radio..
what i want is put the list of link of the radio, some of my page.
ang if i click on one of the link,i want it play automatically to my embeded player..is it possible form javascript..any one can help me..?

thanks....

sorry for my english..
white is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 01-14-2009, 12:40 PM Re: radio station selection
wayfarer07's Avatar
Poo on You

Latest Blog Post:
Introducing WowWindow
Posts: 3,985
Name: Abel Mohler
Location: Asheville, North Carolina USA
Trades: 0
You could build a function which changes the value of the <param> with a name="src" I believe...

If you put location of the "radio station" into the href="" of each link, you could stop the link from being followed and use its value to update the <param>

So let's say you wrap the linklist in an ID, called "radio-stations":
HTML Code:
<div id="radio-stations">
<a href="http://eradioportal.com/some-station.asx">Station 1</a>
<a href="http://eradioportal.com/some-station2.asx">Station 2</a>
<a href="http://eradioportal.com/some-station3.asx">Station 3</a>
</div>
Then, assuming there is only the one object on the page, you could stick this script down at the bottom or the page, right before the closing </body> tag:
Code:
<script type="text/javascript">
var a=document.getElementById("radio-stations").getElementsByTagName("a");
for(var i = 0; i < a.length; i++) {
     a[i].onclick = function() {
          var station = document.getElementsByTagName("object")[0];
          station.data = this.href;
          station.getElementsByName("src")[0].value = this.href;
          return false; //stops link from being followed when clicked
     }
}
</script>
I didn't test it, but if the value of the data attribute on the <object> and the value attribute of the <param> named "src" is what is controlling which station is being heard, something along these lines should work.
__________________
Join me on
Please login or register to view this content. Registration is FREE

Last edited by wayfarer07; 01-14-2009 at 12:42 PM..
wayfarer07 is offline
Reply With Quote
View Public Profile Visit wayfarer07's homepage!
 
Old 01-15-2009, 09:19 AM Re: radio station selection
Junior Talker

Posts: 4
Name: clyght malundras
Trades: 0
hey thanks for your reply..

but i cant figure it out..

can you make it a further explanation? or a little sample?

with my embeded code
PHP Code:
<object type="video/x-ms-wmv" data="http://eradioportal.com/energyfm-metromanila.asx" width="100%" height="64">
<
param value="1" name="ShowStatusBar">
<
param value="1" name="enableContextMenu">
<
param value="http://eradioportal.com/energyfm-metromanila.asx" name="src">
<
param value="1" name="autostart">
<
param value="0" name="volume"></object
and your codes..

HTML Code:
<div id="radio-stations">
<a href="http://eradioportal.com/some-station.asx">Station 1</a>
<a href="http://eradioportal.com/some-station2.asx">Station 2</a>
<a href="http://eradioportal.com/some-station3.asx">Station 3</a>
</div>
Code:
<script type="text/javascript">
var a=document.getElementById("radio-stations").getElementsByTagName("a");
for(var i = 0; i < a.length; i++) {
     a[i].onclick = function() {
          var station = document.getElementsByTagName("object")[0];
          station.data = this.href;
          station.getElementsByName("src")[0].value = this.href;
          return false; //stops link from being followed when clicked
     }
}
</script>
please here is the 2 exmaple link of the radio station..
Code:
http://eradioportal.com/ifm.asx
http://www.eradioportal.com/dzrj-fm.asx
beacuse when i click it on div id it will open on wmp not the player on my website..

hope you understand....thanks...
white is offline
Reply With Quote
View Public Profile
 
Old 01-15-2009, 11:03 AM Re: radio station selection
wayfarer07's Avatar
Poo on You

Latest Blog Post:
Introducing WowWindow
Posts: 3,985
Name: Abel Mohler
Location: Asheville, North Carolina USA
Trades: 0
Hi, I tested this out for you, and apparently, when you try to update the "param" as well as the "object data", it throws things out of whack (no idea why, anyone have an explanation?). So by deleting the line that does that update, everything works fine. The above JavaScript becomes:
Code:
<script type="text/javascript">
var a=document.getElementById("radio-stations").getElementsByTagName("a");
for(var i = 0; i < a.length; i++) {
     a[i].onclick = function() {
          var station = document.getElementsByTagName("object")[0];
          station.data = this.href;
          return false; //stops link from being followed when clicked
     }
}
</script>
Here is a sample of the working test: http://wayfarerweb.com/radio.php
__________________
Join me on
Please login or register to view this content. Registration is FREE
wayfarer07 is offline
Reply With Quote
View Public Profile Visit wayfarer07's homepage!
 
Old 01-16-2009, 02:19 AM Re: radio station selection
Junior Talker

Posts: 4
Name: clyght malundras
Trades: 0
wow great it works...thanks a lot my friend...
its hard for me to understand..but i got it at last..
i saved your page and read the whole codes...and now i know..

i will try to test it if it will work on the drop down list for station..can you?heheheh!! last request..so that no mess if i add 10 links for radio station...
white is offline
Reply With Quote
View Public Profile
 
Old 01-16-2009, 09:22 AM Re: radio station selection
Junior Talker

Posts: 4
Name: clyght malundras
Trades: 0
i dont know whats wrong when i put the codes on my forum it doesnt work..but when i put it on dreamwaver ang create anew html it works...

anyway i decided to make a lot of html page and every html had a embeded code with different radio station and put it to iframe so that not the page will reload when i click on the link...

here is my site http://www.whitedesktop.com/forum/index.php i put a drop down menu to have no mess on my page..thanks for your help..i will appreciate your replies...
white is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to radio station selection
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.29673 seconds with 12 queries