View Full Version : Can i some how make a #65 link to say this javascript:Play(65,2,0,0,0)

10-19-2006, 01:40 PM
Hi guys i would like to know if i can do the following.

I own a site called qipcast.com which is at http://www.qipcast.com it uses javascript to get the stations url to play the TV or radio station. however i would like people to be able to do the following.

If you know html you would know that you can make a think that looks like this #top and it would make the page go to the top of the page (you do need to have a bookmark). However i would like it so if a user knows the station he or she wants to tune into they can type something like the following

http://www.qipcast.com/#65 and it would play javascript:Play(65,2,0,0,0)

Is this possible?


p.s. if you know of a TV or radio station that you would like me to add please email us admin [at] qipcast.com

10-19-2006, 01:50 PM
# is used for targets (anchors? never sure about the term).

Basically... it jumps around on the page.

It's also used to use a tags for javascript, not links.

<a href="#" onClick="javascript:Play(65,2,0,0);">

Or, <a href="#62" .....>

10-21-2006, 11:03 AM
yes i know but is there any way i can make it so that when you go to the site instead of having to click news, sports, etc they just type in http://www.qipcast.com/#(name or number) or http://www.qipcast.com/(name or number)

10-21-2006, 03:21 PM
add the following to the head of the page

<script type="text/javascript">
window.addEventListener("load",CheckHash,false);//W3C load advanced model
else if(window.attachEvent){
window.attachEvent("onload",CheckHash);//IE advanced model
window.onload = CheckHash;//If all else fails use traditional model
function CheckHash(){
if(window.location.hash.length > 1){
var num = window.location.hash.substr(1) * 1;

10-22-2006, 02:03 PM
great it works thanks so much

10-22-2006, 11:16 PM
Ah, sorry about the confusion.
That should work.

Use the method I mentioned in the page itself to change the song or whatever, so that you don't need to refresh, but use the method above if you're linking to the page from outside.