Javascript variable into HTML link

Discussion in 'JavaScript' started by Sushi_Master, May 28, 2009.

  1. #1
    I need to output a javascript value for screen.width and screen.height into a simple html link.

    e.g.

    
    <a href="http://mysite/myfolder/?keepThis=true&amp;TB_iframe=true&amp;height=[B]HELP[/B]&amp;width=[B]HELP[/B]" class="smoothbox" title="mypage">mypage</a>
    
    Code (markup):
    Is there a way to directly apply the value where I hightlighted "HELP", or is there a different method needed?

    Thanks in advance for your advice.
     
    Sushi_Master, May 28, 2009 IP
  2. Sushi_Master

    Sushi_Master Peon

    Messages:
    55
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #2
    I've just managed to tinker with it a bit further and got it working

    here is my code

    document.write('<a href="http://mysite/myfolder/?keepThis=true&amp;TB_iframe=true&amp;height='+ screen.height +'&amp;width='+ screen.width +'" class="smoothbox" title="mypage">mypage</a>');
    Code (markup):
    Took me a while to do this as I'm not a JavaScript programmer
     
    Sushi_Master, May 28, 2009 IP