Append link code

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • LsK_Lele

    Append link code

    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.getEle mentById("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_bla nk\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

    #2
    Re: Append link code

    essauyez :


    <body>

    <div id="MyDiv">essa i</div>


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



    </body>

    LsK_Lele a écrit:[color=blue]
    > 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.getEle mentById("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_bla nk\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 !
    >
    >[/color]

    Comment

    Working...