Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - Can I do this - Jscript and VBScript
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Can I do this - Jscript and VBScript

 Post Reply Post Reply
Author
oneminuteguy View Drop Down
Mod Builder Group
Mod Builder Group
Avatar

Joined: 18 October 2002
Location: Denmark
Status: Offline
Points: 100
Post Options Post Options   Thanks (0) Thanks(0)   Quote oneminuteguy Quote  Post ReplyReply Direct Link To This Post Topic: Can I do this - Jscript and VBScript
    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

Back to Top
KCWebMonkey View Drop Down
Senior Member
Senior Member
Avatar
Go Chiefs!

Joined: 21 June 2002
Status: Offline
Points: 1319
Post Options Post Options   Thanks (0) Thanks(0)   Quote KCWebMonkey Quote  Post ReplyReply Direct Link To This Post 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.

Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.