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.

javascript document.write() execution error

Discussion in 'Programming' started by omar_391, Sep 28, 2009.

  1. #1
    Without elaboration plz see my code:
    
    <body>
    <script>
    var b="s";
    </script>
    
    <button target="_blank" onclick="window.open('http://......php?b="javascript:document.write(b);"&id=2&q=<?php print $_GET['q']; ?>','1','');return false;">xyz</button>
    </body>
    
    Code (markup):
    i don understand why this javascript:document.write(b); doesnt work in url...
    i know its simple yet it make my hair out of my head. plz count it..
     
    omar_391, Sep 28, 2009 IP
  2. caprichoso

    caprichoso Well-Known Member

    Messages:
    433
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    110
    #2
    You have a big conceptual error here. You are messing things up.

    
    <script>
    var url = 'http://......php?id=2&q=<?php print $_GET['q']; ?>&b=';
    </script>
    <button target="_blank" onclick="window.open(url + b, '1', ''); return false;">xyz</button>
    
    Code (markup):
     
    caprichoso, Sep 28, 2009 IP