Click to See Complete Forum and Search --> : Lock source window scrolls when opening new window


jeepslug
04-17-2004, 03:29 PM
I have some javascript that opens a new window when you click on a link. The problem is that it the window that the link is in resets itself to the top of the page. In other words, it scroll all the way to the top. I would like the source window to remain in the place where the link was after opening the new window. Any ideas would be appreciated.

Here is the script I am using:

<script language="javascript" type="text/javascript">
<!--
function showFullImage(sImageName)
{
var winNew = window.open("about:blank", "new", "width=800, height=650, toolbar=yes scrollbars=yes,resizable=yes");
winNew.document.write("<img border='0' src='" + sImageName + "'><br>"); // <== here
winNew.document.write("<center><INPUT TYPE='button' VALUE='Close Window' onClick='window.close()'></center>");
winNew.document.bgColor="#800000"

}

// -->
</script>

Jeepslug

96turnerri
04-17-2004, 03:58 PM
when you are calling it

<a href="javascript:showFullImage(sImageName);">CLICK HERE</a>

add return false

making it

<a href="javascript:showFullImage(sImageName); return false;">CLICK HERE</a>

jeepslug
04-17-2004, 04:14 PM
That solved the problem. Thanks 96turnerri!

96turnerri
04-18-2004, 12:57 PM
np ;)

ps welcome to the forums