Print Page | Close Window

Can I do this - Jscript and VBScript

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: General Discussion
Forum Description: General discussion and chat on any topic.
URL: https://forums.webwiz.net/forum_posts.asp?TID=3047
Printed Date: 29 March 2026 at 10:15am
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: Can I do this - Jscript and VBScript
Posted By: oneminuteguy
Subject: Can I do this - Jscript and VBScript
Date Posted: 27 May 2003 at 12:49am

I've been trying to create a form which is prefilled with info based on which link the user clicks. Since I'm not a hard core coder, I've asked around - and this was the solution I was suggested:

Querystrings with id tags and a Jscript function which looks like this:

<%@ Language="JScript" %>
<%
function RTS(inObject) {
  inStr = String(inObject);
  if (inStr=="undefined" || inStr=="null") {
    inStr = "";
  }
    return inStr;
}
id = RTS(Request.QueryString("id"));
if(id=="1") {
activity = "Activity 1";
loc = "Location 1";
date= "Date 1";
time = "Time 1";
price = "Price 1";
}
if(id=="2") {
activity = "Activity 2";
loc = "Location 2";
date= "Date 2";
time = "Time 2";
price = "Price 2";
}

  if (RTS(Request.Form("send"))!="1") {
 
%>


It works perfectly!  But when I tried to add my header.asp and footer.asp, which contains VBScript code and a link to a default javascript page, i get this error:


Active Server Pages error 'ASP 0140'
Page Command Out Of Order
/form.asp
, line 8
The @ command must be the first command within the Active Server Page.

Line 8 reads: function RTS(inObject) {

So my question is: Is what I'm trying to do possible at all; I mean can I combine the two?? (The header with this piece of Jscript code). Or am I - not unlikely - missing something??

Or does anybody know another script that can do what this Jscript does and is more compatible with my header??

TIA

Regards,
OMG




Replies:
Posted By: KCWebMonkey
Date Posted: 27 May 2003 at 6:44am

That's because

<%@ Language="JScript" %>

Has to be the first line of code in your page... It declares what type of language your ASP will be.




Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net