Results 1 to 6 of 6

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

  1. #1
    Join Date
    May 2006
    Posts
    266
    Thanks
    1
    Thanked 0 Times in 0 Posts

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

    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?

    Thanks

    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

  2. #2
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    # 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" .....>
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  3. #3
    Join Date
    May 2006
    Posts
    266
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    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)

  4. #4
    Join Date
    Sep 2005
    Posts
    882
    Thanks
    0
    Thanked 3 Times in 3 Posts

    Default

    add the following to the head of the page
    Code:
    <script type="text/javascript">
    if(window.addEventListener){
        window.addEventListener("load",CheckHash,false);//W3C load advanced model
    }
    else if(window.attachEvent){
        window.attachEvent("onload",CheckHash);//IE advanced model
    }
    else{
    	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;
    		Play(num,2,0,0);
    	}
    }
    </script>

  5. #5
    Join Date
    May 2006
    Posts
    266
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    great it works thanks so much

  6. #6
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    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.
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •