1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

document.location.href - Not Working

Discussion in 'JavaScript' started by martinvidic, Jul 16, 2011.

  1. #1
    Hi : )

    I'm trying to open to open a window for somedomain.com/blabla + pagewherelinkwasclicked.com. But somthing is wrong, because document.location.href doesnt work.


    <script type="text/javascript"> 
    function popup(ref_param){ 
    var myString = 'http://www.somedomain.com' + ref_param; 
    window.open(myString, 'FullRecord', 'width=1000,height=650,scrollbars=yes'); 
    } 
    </script> 
    				  
    <a href="#" onclick="javascript:popup('[B][COLOR="red"]document.location.href[/COLOR][/B]')">test popup</a>
    Code (markup):
    Does anybody know what Im doing wrong?
     
    martinvidic, Jul 16, 2011 IP
  2. Jan Novak

    Jan Novak Peon

    Messages:
    121
    Likes Received:
    5
    Best Answers:
    1
    Trophy Points:
    0
    #2
    instead of
    function (ref_param){
    write
    function popup(ref_param){
     
    Jan Novak, Jul 17, 2011 IP
  3. dthoai

    dthoai Member

    Messages:
    106
    Likes Received:
    2
    Best Answers:
    1
    Trophy Points:
    38
    #3
    Change this line to:
    
    <a href="#" onclick="javascript:popup(document.location.href)">test popup</a>
    
    Code (markup):
     
    dthoai, Jul 22, 2011 IP