473,387 Members | 1,492 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Javascript works locally but not when uploaded

12
Hi,
I've been trying to create a menu with animated mouseOvers using script instead of Flash. It works locally in Firefox but won't load at all in Safari (blank page). Then when I upload it to the server the mouseOvers stop working in Firefox.


The broken file is at :
http://www.chimpanzoo.co.uk/main_projects_no_flash.html

The animations should work like the Flash version at this site:
http://www.la-design.co.uk/english/html/main.html

I've tried changing my paths to the gifs from 'buttons/about.gif' to '../buttons/about.gif' in case this helps FF but it still won't work.

It's a work in progress so please ignore the links in the site!


Let me know if you need more info

Thanks for any help
Corrie
Jan 17 '11 #1
5 3411
dlite922
1,584 Expert 1GB
Do you see any errors in Firefox? Go to Tools -> Error Console when accessing the page. If there are lots of stuff there. Hit Clear and refresh the page.

Is your page valid? Use w3c.org's validator to ensure you have correct HMTL or XHTML.

DM
Jan 17 '11 #2
Corrie
12
Thank you, I'll give that a go, may seem obvious, but I'm pretty new!
Thanks
Jan 18 '11 #3
Corrie
12
I'm such a donut!

I still had:
<script language="javascript>

instead of:

<script type="text/javascript">

That only fixes the animation problem though and it still won't open in Safari.

w3c's validator brings up a bunch of things that don't make sense to me e.g.
'end tag for element "body" which is not open'

I have an opening and closing body tag, no others so why is this wrong?

Other errors don't make sense to me either.

Any help would be greatly appreciated.

Thanks
Jan 18 '11 #4
Corrie
12
This block in my <head. tags is what's stopping it working in Safari:

<script type="text/javascript">
<!--
// PRELOADING IMAGES
if (document.images) {
button1_on =new Image(); button1_on.src ="buttons/about_hover.gif";
button1_off=new Image(); button1_off.src="buttons/about.gif";

button2_on =new Image(); button2_on.src ="buttons/product_areas_hover.gif";
button2_off=new Image(); button2_off.src="buttons/product_areas.gif";

button3_on =new Image(); button3_on.src ="buttons/news_hover.gif";
button3_off=new Image(); button3_off.src="buttons/news.gif";

button4_on =new Image(); button4_on.src ="buttons/contact_hover.gif";
button4_off=new Image(); button4_off.src="buttons/contact.gif";

}

function mouseOver(k) {
if (document.images)
eval('document.button'+k+'.src=button'+k+'_on.src' );
}

function mouseOut(k) {
if (document.images)
eval('document.button'+k+'.src=button'+k+'_off.src ');

}


</script>




If I remove this the page opens fine but without the above functionality. Put this back in and the page is blank again.

Any Ideas?

Thanks
Jan 18 '11 #5
Corrie
12
Fixed it...
My comment <!--// PRELOADING IMAGES
needed to have --> at the end
Because Firerfox worked without it I didn't suspect that to be the problem.

Thanks so much dlite922 for pointing me in the right direction.
C
Jan 18 '11 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: ConTactMe | last post by:
I got this code off of javascriptsource.com, and it works like a charm locally. I can't get it to work on the server. I need some coffee. I don't _DRINK_ *coffee*! Can anyone check out the...
33
by: n00m | last post by:
import socket, thread host, port = '192.168.0.3', 1434 s1 = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s2 = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s2.connect((host, 1433))...
2
by: Luke | last post by:
Hi I have the following code which is an ASP questionnaire using an Access database. (I am using access as I have no choice!). Basically there is an html form which submits the form to the page...
1
by: Andy | last post by:
We have an ASP.NET application exported from MS Access 2003. I uses a series of queries to generate a page showing todays bookings. It works locally but does not work when we put it on a...
5
by: Grigs | last post by:
Hello, I have a project that contains a WebService that works great when connecting to it on my Localhost. Once we post the files to the test web server, all of the pages that do not touch the...
1
by: larrylyons | last post by:
I have a javascript page that I used sucessfully on the net three years ago. I am trying to use it again and although it works fine when I preview it in a browser, It won't work when posted and...
1
by: david | last post by:
My question is how to keep the values of JavaScript variable unchanged when the page is posted back to the server? Problem: The JavaScript is used in HTML for computing in aspx web page (form)...
5
by: jauiek | last post by:
Hello, I have been trying to learn PHP and have been spending all day trying to solve this "simple" problem. I am using Mac OS X 10.4. I am trying to create a site for myself that gets me out of...
10
by: rbenditt | last post by:
I've put together a simple script that uses the XMLHttpRequest() function. It works when I run it locally, but when I upload it to my web hosting account, I never get a response back. Here is what I...
2
by: dogged | last post by:
Website works locally but not when deployed ================================== Can someone please help with what I hope is a common problem (I’m new to .net). I have a simple website generated...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.