Jump to content

Total Newbie Swims Toward The Server-Side (Include) Of Life...!


swirlingDervish

Recommended Posts

Trying some simple code hiding with ASP, but the w3school tutorials are just a little confusing as to when to use which heading for which result. I'm trying to maintain javascript buttons that call a JS script in an external ASP sheet: will simple includes do or do I need to do some getting and posting from the "onClick"? Does the onClick need to be VBscripted? To completely hide it (even source code side) do I need to use .asp extension or is .inc fine?...and how do I head up the main file, as an HTML or an ASP...? <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><script language="javascript" runat="server"><!--#include file="<%/scripts/chcDescrips.asp%>"--> </script> <body> <td width="38" height="54"><a href="javascript:arrayResult(0);"><img src="images/buttonWhite.png" width="30" height="30"></a></td></body>

Link to comment
Share on other sites

Anything that's running on the server won't be available after the page has loaded. The server first executes all the server-side code, generates the content and sends it to the user. Once the page has been sent to the user, server-side code won't run anymore. Removing the runat="server" will run the Javascript on the client side.

Link to comment
Share on other sites

Hi, Ingolme, thanks for the 2 cents, but I'm still coming up code-result empty! My include has a js function to open answers to button questions in a <div> box....it doesn't seem to be as simple as an include to bring the answers from server-side. Do I need to enclose in vb script, as the loaded source code doesn't seem to open the include...?

Link to comment
Share on other sites

Well, still trying to get my server-handled code shown: <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><%@ language="javascript" %><!--#include file="<%/scripts/chcDescrips.asp%>"--> </head> <td width="38" height="54"><a href="javascript:arrayResult(0);"><img src="images/buttonWhite.png" width="30" height="30"></a></td> ...you know me, "syntaxed!" What seems to be wrong...?

Link to comment
Share on other sites

It's not correct. I believe the @LANGUAGE declaration needs to be first on the page, before any other ASP code. There can also only be one of those declarations. Check the reference here for including files: http://w3schools.com/asp/asp_incfiles.asp Note that ASP tags are not part of the filename.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...