How do I use JAVA script on an ASP page. Looking in the book I think I have to use the tags 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
![]() |
Patch reliability is unclear, but widespread attacks make patching prudent. Go ahead and patch, but watch out for potential problems. |
SIGN IN | Not a member? | REGISTER | PLUS MEMBERSHIP |
Home » Forums » Developers, developers, developers » Web design and development » 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:
(2) Put your server-side code in 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”). Writing Procedures
(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?
Donations from Plus members keep this site going. You can identify the people who support AskWoody by the Plus badge on their avatars.
AskWoody Plus members not only get access to all of the contents of this site -- including Susan Bradley's frequently updated Patch Watch listing -- they also receive weekly AskWoody Plus Newsletters (formerly Windows Secrets Newsletter) and AskWoody Plus Alerts, emails when there are important breaking developments.
Welcome to our unique respite from the madness.
It's easy to post questions about Windows 11, Windows 10, Win8.1, Win7, Surface, Office, or browse through our Forums. Post anonymously or register for greater privileges. Keep it civil, please: Decorous Lounge rules strictly enforced. Questions? Contact Customer Support.
Want to Advertise in the free newsletter? How about a gift subscription in honor of a birthday? Send an email to sb@askwoody.com to ask how.
Mastodon profile for DefConPatch
Mastodon profile for AskWoody
Home • About • FAQ • Posts & Privacy • Forums • My Account
Register • Free Newsletter • Plus Membership • Gift Certificates • MS-DEFCON Alerts
Copyright ©2004-2025 by AskWoody Tech LLC. All Rights Reserved.
Notifications