Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

page jumps when selecting list box

Status
Not open for further replies.

mfild

Technical User
Nov 1, 2003
22
0
0
GB
Hi,

I have three list boxes. Based on the first selection the second is populated, based on the second, the third is populated. The problem is when you select the first on it refreshes the screen but jumps the page to the top. This happens on each selection. How can I stop this.

Many thanks for any help on this.

 
Try this,

Code:
<html><head>
	<title>Test</title>
</head><body onload="SetFocus ();">

<script language="javascript">
function SetFocus ()
{
	document.getElementById ('lstItems1').focus ();
}
</script>

<form name="frmMain">

	<select id="lstItems1" onchange="SetFocus ();">
		<option>Item 1</option>
		<option>Item 2</option>
		<option>Item 3</option>
	</select>

	<select id="lstItems2">
		<option>Item 1</option>
		<option>Item 2</option>
		<option>Item 3</option>
	</select>

	<select id="lstItems3" onchange="SetFocus ();">
		<option>Item 1</option>
		<option>Item 2</option>
		<option>Item 3</option>
	</select>

</form>

</body></html>

- VB Rookie
 
Hi VB Rookie,

I took out the semicolons and it works a treat. Many thanks for your help on this one.

Happy coding
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top