How to show html from a js script

Discussion in 'JavaScript' started by mailcol, Sep 28, 2007.

  1. #1
    hi, everyone know that google using
    <script type="text/javascript"
      src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
    </script>
    Code (markup):
    to display the ads. And the view source actually see nothing of the ads code but jz same like above. Anyone know how to do tht? i tried to search from net but seems like cant get my answer

    Thanks for helping
     
    mailcol, Sep 28, 2007 IP
  2. KatieK

    KatieK Active Member

    Messages:
    116
    Likes Received:
    12
    Best Answers:
    0
    Trophy Points:
    58
    #2
    If you want to view the post-render code on a page, the best thing that I've found is the View Source Chart add-on for Firefox. You can also use the Web Developer Toolbar; choose View Generated Source from the View Source menu, but I've found the collapsible code blocks from View Source Chart to be most useful.

    I think using the "Save As..." in IE will get you the rendered JS code, but I don't trust it that much.
     
    KatieK, Sep 28, 2007 IP
  3. mailcol

    mailcol Peon

    Messages:
    105
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    oh, i am not trying to get the 'source' of the ads, but i am asking, 'how to' use the JS code like the google, to connect with my server, and return a meaningful info.

    E.g.
    
    <script type="text/javascript">
    member_id = 1234;
    
     ... some javascript to set the member id so that server can capture the member id and return the info of the member
    </script>
    <script type="text/javascript"
      src="http://mydomain.com/show_member.js">
    </script>
    HTML:
    I am asking how to make all this happen, JS interact with server and return a member's info
     
    mailcol, Sep 29, 2007 IP
  4. swordbeta

    swordbeta Banned

    Messages:
    225
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #4
    <script>
    <!--
    a = 0;
    document.write("<scri"+"pt type='text/javascript' src='http://mydomain.com/show_member.js'> </scr"+"ipt");
    //-->
    </script>
    Code (markup):
    In the show_member.js:
    if(a==0){
    document.write("True!");
    }
    Code (markup):
    ?
     
    swordbeta, Sep 29, 2007 IP
  5. mailcol

    mailcol Peon

    Messages:
    105
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Thanks bro, it solve my problem
     
    mailcol, Sep 29, 2007 IP
  6. swordbeta

    swordbeta Banned

    Messages:
    225
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #6
    No problem :)
     
    swordbeta, Sep 30, 2007 IP
  7. mailcol

    mailcol Peon

    Messages:
    105
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #7
    After i compare urs with google's. I found that ur code are actually a 'write' call to script, and it's different from the technique adopt by google i believe
     
    mailcol, Sep 30, 2007 IP