Append link code

Discussion in 'Javascript' started by LsK_Lele, Aug 6, 2004.

  1. LsK_Lele

    LsK_Lele Guest

    Hello !
    I have a DIV, with a code inside it ...
    I have to append dinamically some HTML code to this code, this code my
    contain links ...
    i tryed:

    oDiv = document.getElementById("MyDiv")
    oDiv.innerHTML = oDiv.innerHTML + "<a href=\"http://www.google.com\"
    target=\"_blank\">http://www.google.com</a>"
    Or
    oDiv.innerHTML = oDiv.innerHTML + '<a href=\"http://www.google.com\"
    target=\"_blank\">http://www.google.com</a>'
    Or
    oDiv.innerHTML = oDiv.innerHTML + "<a href=\x22http://www.google.com\"x22
    target=\x22_blank\x22>http://www.google.com</a>"

    But the window opened by this code does not points to www.google.com, but to
    "http://localhost/www.google.com

    Can someone help me ?
    Thank you very much !
    LsK_Lele, Aug 6, 2004
    #1
    1. Advertising

  2. LsK_Lele

    G Roydor Guest

    essauyez :


    <body>

    <div id="MyDiv">essai</div>


    <br>
    <script>
    oDiv = document.getElementById("MyDiv")
    oDiv.innerHTML = oDiv.innerHTML + "<a href=http://www.google.com
    target=_blank>http://www.google.com</a>"
    </script>



    </body>

    LsK_Lele a écrit:
    > Hello !
    > I have a DIV, with a code inside it ...
    > I have to append dinamically some HTML code to this code, this code my
    > contain links ...
    > i tryed:
    >
    > oDiv = document.getElementById("MyDiv")
    > oDiv.innerHTML = oDiv.innerHTML + "<a href=\"http://www.google.com\"
    > target=\"_blank\">http://www.google.com</a>"
    > Or
    > oDiv.innerHTML = oDiv.innerHTML + '<a href=\"http://www.google.com\"
    > target=\"_blank\">http://www.google.com</a>'
    > Or
    > oDiv.innerHTML = oDiv.innerHTML + "<a href=\x22http://www.google.com\"x22
    > target=\x22_blank\x22>http://www.google.com</a>"
    >
    > But the window opened by this code does not points to www.google.com, but to
    > "http://localhost/www.google.com
    >
    > Can someone help me ?
    > Thank you very much !
    >
    >
    G Roydor, Aug 6, 2004
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Kevin Spencer

    Re: Link Link Link DANGER WILL ROBINSON!!!

    Kevin Spencer, May 17, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    794
    Kevin Spencer
    May 17, 2005
  2. Rich
    Replies:
    0
    Views:
    690
  3. HYRY
    Replies:
    10
    Views:
    584
    Bruno Desthuilliers
    Sep 26, 2007
  4. Dave Angel
    Replies:
    4
    Views:
    284
    Piet van Oostrum
    Jul 6, 2009
  5. pt36
    Replies:
    9
    Views:
    632
    Thomas 'PointedEars' Lahn
    Jul 13, 2008
Loading...

Share This Page