Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    Regular Coder
    Join Date
    Jun 2002
    Location
    England, Hythe
    Posts
    207
    Thanks
    0
    Thanked 0 Times in 0 Posts

    function opening a new page

    when i run my function inside my page it opens the documnet.write in a new page. this is my code

    <input name="FldDone" type="checkbox" id="FldDone" value="checkbox" onClick="javascript:UpDate('<%=rs("ID")%>');">

    <script language="JavaScript">
    function UpDate(ID) {

    document.write ("<a href=test.asp?Action=UpDate&ID="+ID+" target=_self>UpDate</a>");

    }
    </script>

    i need the link that the UpDate() function writes just to appear on the page not on a new page all of its own


    thanks for the help

  • #2
    Regular Coder
    Join Date
    Jan 2003
    Posts
    867
    Thanks
    4
    Thanked 8 Times in 8 Posts
    Do you have a <base target="something"> on that page? Do you specify a target in your <form> tag?

    You can try explicitly making those both target="_self" also, but your shouldn't have to.

  • #3
    Regular Coder
    Join Date
    Jun 2002
    Location
    England, Hythe
    Posts
    207
    Thanks
    0
    Thanked 0 Times in 0 Posts
    i dont have anytargeting anywhere in the for or the page. i dont understand it

  • #4
    Regular Coder
    Join Date
    Jan 2003
    Posts
    867
    Thanks
    4
    Thanked 8 Times in 8 Posts
    Does it open in a new page or just clear the contents of the current page (a very subtle but important difference for troubleshooting)? I realize now that it is most likely just clearing the contents of your page.

    You can try updating a div with innerHTML, but this might create new problems for you as far as positioning.

    Code:
    <html>
    <head>
    <script language="JavaScript">
    function UpDate(ID, divid) {
    divid.innerHTML="<a href=test.asp?Action=UpDate&ID="+ID+" target=_self>UpDate</a>";
    } 
    </script>
    </head>
    
    <body>
    <div id="mydiv"></div>
    <form>
    
    <input name="FldDone" type="checkbox" id="FldDone" value="checkbox" onClick="javascript:UpDate('<%=rs("ID")%>', document.all.mydiv);">
    
    </form>
    This text will stay.
    </body>
    </html>
    Last edited by arnyinc; 06-04-2003 at 06:49 PM.

  • #5
    Regular Coder
    Join Date
    Jun 2002
    Location
    England, Hythe
    Posts
    207
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thank you very much that worked fine. and next time i will say "clear the screen not opeing a new window" looking back on it it does make just a small difference


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •