Connecting Tech Pros Worldwide Forums | Help | Site Map

Getting window to open at top

Newbie
 
Join Date: Apr 2007
Posts: 1
#1: Apr 12 '07
Hello,

I have a set of functions that call a page from one frame (the menu) into an iframe and then spit the page up into a div on the current page (in the content section, NEXT to the menu). The only problem is if I call one page and then scroll down, then click on another page from the menu frame, it loads the new page scrolled down some. I can't seem to get it to load the new page at the top.

Any ideas? Perhaps some sort of onload command in the body tag of the new page to be called?

I tried setting an anchor in the body of the new page and then attaching the anchor to the hyperlink text in the javascript code of the menu (which calls the new page) but that doesn't have an effect.

Thanks for any insight!
-Rick

Newbie
 
Join Date: Apr 2007
Posts: 1
#2: Apr 13 '07

re: Getting window to open at top


[quote=aricknophobia]Hello,

I tried :
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
<script language="javascript" type="text/javascript" >
function login_Click()
{
var retVal = window.showModalDialog('default2.aspx');
var result = document.getElementById('Result');

result.innerHTML = retVal;
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<table>
<tr >
<td >
<input type="button" id="login" value="Login" onclick="javascript:login_Click();"/>
</td>
</tr>
<tr>
<td>
<asp:Label ID="Result" runat="server"></asp:Label>
</td>
</tr>
</table>
</div>
</form>
</body>
</html>
acoder's Avatar
Site Moderator
 
Join Date: Nov 2006
Location: UK
Posts: 14,581
#3: Apr 13 '07

re: Getting window to open at top


Try
Expand|Select|Wrap|Line Numbers
  1. window.scrollTo(0,0);
See link.
Reply