Results 1 to 2 of 2

Thread: JAVA and ASP

  1. #1
    5 Star Lounger
    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

  2. #2
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Silicon Valley, USA
    Thanked 94 Times in 90 Posts

    Re: JAVA and ASP

    You can use JavaScript in an ASP page, but not a JAVA applet, because the page is executed on the server, not in the browser. The ASP DLL expects pages to be written in VBScript by default. To incorporate JavaScript into the page, you have several options:

    (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:


    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=>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?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts