View Full Version : function opening a new page

06-04-2003, 09:02 AM
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>");


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

06-04-2003, 02:52 PM
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.

06-04-2003, 02:58 PM
i dont have anytargeting anywhere in the for or the page. i dont understand it

06-04-2003, 05:36 PM
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.

<script language="JavaScript">
function UpDate(ID, divid) {
divid.innerHTML="<a href=test.asp?Action=UpDate&ID="+ID+" target=_self>UpDate</a>";

<div id="mydiv"></div>

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

This text will stay.

06-04-2003, 06:35 PM
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 :thumbsup: