Click to See Complete Forum and Search --> : page reload focus question


yardleybates
06-17-2003, 09:50 AM
I have a function on my page that reloads a screen. On the refresh, can you set the focus to a specific area on the screen? If so, how?

cmelnick
06-17-2003, 09:55 AM
If you are talking about giving focus to a form item, this would be javascript, and it would be something like:

<body onLoad="document.test.testText.focus();">
<form name="test">
<input type="text" size=20 name="testText">
</form>
</body>

(You can put the document.test.testText.focus() wherever you need it.)

If you mean jumping to an anchor, see http://forums.webdeveloper.com/showthread.php?s=&threadid=11192

yardleybates
06-17-2003, 10:12 AM
But ... I only want to set this focus on the reload, not on the initial load.

cmelnick
06-18-2003, 09:13 AM
To expand on that...



<%
Dim strOnLoad
strOnLoad = ""
If <your test for a reloaded vs a normal load> Then
strOnLoad = " onLoad=""document.test.testText.focus();"""
End If

%>

<body<%=strOnLoad%>>
<form name="test">
<input type="text" size=20 name="testText">
</form>
</body>