?
Solved

Using HTML include file with JavaScript

Posted on 2003-03-05
4
Medium Priority
?
167 Views
Last Modified: 2013-11-18
I am trying to run a java menu. All the js files are in the menu directory at the root of Web site. I want to use this HTML page as an include file and a header from other directories, it only works when the file calling is in the same directory. Below is some of the code from the header.html file. How can I "call", from an ASP page, this js file from inside an include file from another directory?

Ex: (Header.Html)
<BODY bgcolor="#3A6EA5" text="#FFFFFF">

<SCRIPT LANGUAGE="JavaScript1.2"
        SRC="Menu_Loader.js"
        TYPE='text/javascript'></SCRIPT>
       
<p align="center"><font size="4" face="Arial">Web Site header</font></p>
<p align="center"> </p>

EX: (Page.asp)
<!--#include file="menu/Header.html"-->
0
Comment
Question by:Kenyonjr
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 19

Accepted Solution

by:
webwoman earned 300 total points
ID: 8074872
This is tough...

You can't use the path where the include file is, since it's not in the same directory as the ASP page, and that's where you need to calculate the path from.

Why not use an absolute address for the include? If it's the same include all the time, and it's not moving, that should work.

So rather than Menu_loader.js you'd use http://www.mysite.com/myfiles/Menu_loader.js

You're in the same domain, so you don't have any cross domain issues. It should work.
0
 
LVL 16

Expert Comment

by:jaysolomon
ID: 10097643
No comment has been added lately, so it's time to clean up this TA.
I will leave the following recommendation for this question in the Cleanup topic area:

Accept: webwoman {http:#8074872}

Please leave any comments here within the next seven days.
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

jAy
EE Cleanup Volunteer
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

SASS allows you to treat your CSS code in a more OOP way. Let's have a look on how you can structure your code in order for it to be easily maintained and reused.
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question