Skip to main content
gamedev.net
🔒 Locked

[web] Sharing code between pages

Started by Talib Jan 30, 2006 at 3:50 AM 3 replies 600+ views
Original Post
Talib
Talib
I have a moveable menu (&#106avascript) on all my webpages. However, when I change this menu I need to edit all the other pages. I've tried writing a &#106avascript function that uses document.write() to display the menu code. This does not seem to work well with my movemenu code (IE complains that the script will slow the page down too much). I'm suspecting that the setTimeout() function in my movemenu code forces my menu code to be reloaded everytime. Is there another way of sharing my menu between my pages without using CGI, PHP or &#106avascript. I am not shure if CSS can do it, I doubt it though. Thanks for any help.
Try, try and fucking try again.
mengha
mengha
Wasn't there some CSS bug that let you include &#106avascript? I don't remeber the exact details.
gavco98
gavco98
rather than putting the &#106avascript on each page, put it in its own file, then import the file where you need it with this code:

<SCRIPT LANGUAGE="&#106avascript" SRC="myscript.js"&gt;<br>&lt;/SCRIPT&gt;<br></pre></code></pre>
Gavin Coates
[size="1"]IT Engineer / Web Developer / Aviation Consultant
[size="1"][ Taxiway Alpha ] [ Personal Home Page ]
H_o_p_s
H_o_p_s
just to add on to gavco98, when you include the &#106avascript from the external file, it makes it possible for the browser to cache that file, therefor getting the thing downloaded for each page.

Also, it think that <script type="text/&#106avascript" src="include.js"&gt;&lt;/script&gt; is more xhtml solid.
BRING BACK THE BLACK (or at least something darker)
markr
markr
Be careful that you don't use

<script src="smoething" />


As it's perfectly valid XHTML, but the MSIE parser will ignore the rest of the document.

Mark

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.