...

View Full Version : function opening a new page



Bluemonkey
06-04-2003, 10: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>");

}
</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

arnyinc
06-04-2003, 03: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.

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

arnyinc
06-04-2003, 06: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.



<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>

Bluemonkey
06-04-2003, 07: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:



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum