View Full Version : still having trouble putting java scripts into a page!
glammagod
03-31-2004, 03:38 PM
i have a java menu bar that references a .js file! i wanted to put another script on the same page so Frank told me to put this script into a .js file and reference it "<script...." which worked! but my menu stopped working!!!!!
The menu script references a file<script language="JavaScript" src="navcond.js"></script> but uses java code inserted into the html itself with<script language="JavaScript"> just below the one above!???? what is going on can anyone help?
Roy Sinclair
03-31-2004, 04:01 PM
Make sure the file with the Javascript code in it contains ONLY javascript.
Any HTML in the file can cause the Javascript to not work.
The most common bits of HTML left in those file is the <script> tags themselves and the HTML comment tags <!-- and -->.]
Oh yeah, it would've been better had you posted in the previous thread instead of making a new thread. You are after all still trying to solve the same problem as before.
glammagod
03-31-2004, 09:14 PM
the script for the menu worked before i put the scrolling marquee script in?
some of the script for the menu is within <script> tags in the html document! i have tried putting this in to a .js file and removing any html but still no luck!
Roy Sinclair
03-31-2004, 10:00 PM
This page wouldn't happen to be online so you could post a link to it?
It's really difficult to solve a problem when all you can do is guess.
glammagod
04-02-2004, 02:48 PM
here is the link
click here (http://uk.geocities.com/andrewtimney@btinternet.com)
Currently there is only one javascript on it that runs the menu! when i put my other java script on the menu stops working! the other javascript was a scrolling marquee that i put inside the <body> tags! eg<script language="JavaScript" src="scrolling.js"></script>
I believe there might be a conflict between the two scripts, matching variables? I have never used javascript in a web page before!
and I know I shouldnt be using tables to arrange my page but i am not an expert web designer either!
glammagod
04-02-2004, 02:50 PM
and excuse the content, for some friends to put there pics on!
Roy Sinclair
04-02-2004, 03:29 PM
Your problem is an "onload" conflict, there's one onload event and both scripts are using it and the last one to claim it wins which leaves the other script broken.
Add the second script and change your <body> tag from
<body onload="init()">
to
<body>
Since the second script is loaded in the body of your web it will win the conflict so you've got to add yet another script to your page to make sure the onload functions for both scripts get executed. Place the following after your call to the marquee script.
<script type="text/javascript">
window.onload= new function {populate();init();};
</script>
Sorry that it's not tested but it should work (crossing fingers ;) ).
glammagod
04-05-2004, 03:42 PM
can't get it to work, it still loads the second script and disregards the first!
Roy Sinclair
04-05-2004, 04:35 PM
Looking at the page you linked above it doesn't look like you made any changes. Are you sure your changed pages are getting to your server?
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.