Results 1 to 2 of 2
Thread: JAVA and ASP
2001-12-23, 00:08 #1
- Join Date
- Jul 2001
- NJ, USA
- Thanked 0 Times in 0 Posts
JAVA and ASP
How do I use JAVA script on an ASP page. Looking in the book I think I have to use the tags <applet></applet> tags.
Looking at several books I am not exactly sure how to do it. The script behind what I have been working on is called navcond.js.
Thank you. Fay
2001-12-25, 23:42 #2
- Join Date
- Feb 2001
- Silicon Valley, USA
- Thanked 93 Times in 89 Posts
Re: JAVA and ASP
(1) Change the default language to java script: in the first line of the .ASP file, put:
<%@ LANGUAGE="JScript" %>
(2) Put your server-side code in <SCRIPT> tags with the RUNAT attribute = Server:
<SCRIPT LANGUAGE="JScript" RUNAT=SERVER>
According to one page at MS, the JScript portions will be interpreted before the VBScript portions when you do this ("the code is executed in the following order: Script blocks in non-default languages are executed in order of appearance, then the inline code, and finally the script blocks in the default language"). <A target="_blank" HREF=http://www.microsoft.com/windows2000/en/server/iis/htm/asp/iiwaproc.htm>Writing Procedures</A>
(3) Use a server-side include (I have never done this, but you can read up on it on ASP sites).
But if you are trying to pass the code (or include) through to the page that the user loads, rather than executing it in advance, then you do not want (1) or (2). You want to use the same script include you would use in an HTML page; because it does not have the RUNAT=SERVER attribute, it will simply be coded into the page delivered to the user's browser. Does this make sense?