ASP 101 - Active Server Pages 101 - Web06
The Place ASP Developers Go!

Please visit our partners


Windows Technology Windows Technology
15 Seconds
4GuysFromRolla.com
ASP 101
ASP Wire
VB Forums
VB Wire
WinDrivers.com
internet.commerce internet.commerce
Partners & Affiliates














ASP 101 is an
internet.com site
ASP 101 is an internet.com site
IT
Developer
Internet News
Small Business
Personal Technology

Search internet.com
Advertise
Corporate Info
Newsletters
Tech Jobs
E-mail Offers

ASP 101 News Flash ASP 101 News Flash





ASP Source Code:
<%
Dim bAutoNavigate ' Our flag which indicates autonavigation status
' Set our flag to False unless it's passed on the querystring as True
bAutoNavigate = CBool(Request.QueryString("auto"))
If bAutoNavigate <> True Then bAutoNavigate = False
' If needed include the client side script for the autonavigation
If bAutoNavigate = True Then
	%>
	<SCRIPT ID=clientEventHandlersJS LANGUAGE=javascript>
	<!--
	function filename_onchange() {
		//window.location = document.formNav.filename[document.formNav.filename.selectedIndex].value;
		document.formNav.submit();
		return true;
	}
	//-->
	</SCRIPT>
	<%
End If
' Show our form
' Pretty plain, but you could pull the links from a DB to make things
' more interesting.  See our db_pulldown sample if you're interested.
' The only thing to notice is that I remove the event handler if we're
' not autonavigating.
%>
<FORM NAME="formNav" ACTION="pulldown_nav_go.asp" METHOD="post">
	<SELECT NAME="filename" SIZE="1"<% If bAutoNavigate Then Response.Write " LANGUAGE=javascript onchange=""return filename_onchange()""" %>>
		<OPTION VALUE="pulldown_nav.asp">Where do you want to go?</OPTION>
		<OPTION VALUE="index.asp">Sample Index</OPTION>
		<OPTION VALUE="viewasp.asp?file=pulldown_nav.asp">View ASP</OPTION>
		<OPTION VALUE="viewhtml.asp?file=pulldown_nav.asp">View HTML</OPTION>
		<OPTION VALUE="download.asp?file=pulldown_nav.asp">Download Source Code</OPTION>
	</SELECT>
	<%
	' If we're autonavigating then I hide the submit button
	' since it's not needed.  That is assuming the script works!  ;)
	If Not bAutoNavigate Then
		%>
		<INPUT TYPE="submit" VALUE="Go">
		<%
	End If
	%>
</FORM>
<%' Our little on / off switch.  It passes the opposite of the current setting! %>;
<A HREF="pulldown_nav.asp?auto=<%= Not bAutoNavigate %>">Toggle Auto Navigation</A>

Back the the Sample Output

Back to the Sample Index


Home |  News |  Samples |  Articles |  Lessons |  Resources |  Forum |  Links |  Search |  Feedback

Internet.com
The Network for Technology Professionals

Search:

About Internet.com

Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | E-mail Offers