Advertisement

There's no such thing as a stupid question, but they're the easiest to answer.
Login
Search

Advertisement

Software Development Software Development
Search Search
Search for:
Tech Support Guy > > >

Basic javascript works in IE but not Netscape or FireFox


(!)

DrP's Avatar
DrP DrP is offline DrP has a Profile Picture
Computer Specs
Member with 734 posts.
THREAD STARTER
 
Join Date: Jul 2005
Location: Norwich, UK
19-Aug-2005, 07:10 AM #1
Basic javascript works in IE but not Netscape or FireFox
Hi. I'm trying to learn some basic javascript. I've adapted some code from a member of this forum which changes the source of a large picture when a thumbnail is clicked on.
For now I'm testing it with coloured squares. In IE the page is working perfectly but when the thumbs are clicked in either Netscape or FireFox nothing happens. Can anyone help? Please!
Here's the link
http://www.cliveportman.co.uk/clive_site/home.html

Last edited by DrP; 19-Aug-2005 at 07:08 AM.. Reason: forgot link
brendandonhu's Avatar
Member with 14,681 posts.
 
Join Date: Jul 2002
Location: Ann Arbor, MI
Experience: Advanced
20-Aug-2005, 08:04 PM #2
Link isn't working.
ggordie's Avatar
ggordie ggordie is offline
Member with 143 posts.
 
Join Date: Jul 2005
Location: palm harbor
Experience: Intermediate
20-Aug-2005, 09:10 PM #3
ur probly using Jscript, microsofts version of javascript. javascript was invented by mozilla, th company that makes firefox and netscape, so it's unlikely that javascript isnt working on your mozilla browsers. jscript and javascript are almost the same, but not entirely, so they're easily confused.
DrP's Avatar
DrP DrP is offline DrP has a Profile Picture
Computer Specs
Member with 734 posts.
THREAD STARTER
 
Join Date: Jul 2005
Location: Norwich, UK
21-Aug-2005, 09:32 AM #4
Oops, I changed the link yesterday. Here's the new one:
http://www.cliveportman.co.uk/gallery/gallery.html
When I have a look at it in Firefox I go to the Javascript console and it tells me that big_image is not defined. What does this mean?
aewarnick's Avatar
aewarnick aewarnick is offline
Senior Member with 828 posts.
 
Join Date: Sep 2002
21-Aug-2005, 09:57 AM #5
In programming, when something is not defined it means that a variable was created but has no definition (there is no telling what KIND of variable it is).

Are you able to post some code?
DrP's Avatar
DrP DrP is offline DrP has a Profile Picture
Computer Specs
Member with 734 posts.
THREAD STARTER
 
Join Date: Jul 2005
Location: Norwich, UK
21-Aug-2005, 10:42 AM #6
Sure. This is in the <head>:

<script type="text/javascript">
function changeImage(filename)
{
big_image.src = filename;
}
</script>

And I call the script by clicking on this thumbnail:

<a href="javascript:changeImage('photos/wells_castle.jpg')">
<img src="thumbs/wells_castle_thumb.jpg" alt="Wells Castle"/></a>

And the Big_image is here, which shows the larger photograph:
<div id="main_image">
<img id="big_image" src="../white_square.gif" alt=""/>
</div>

Does that help?
aewarnick's Avatar
aewarnick aewarnick is offline
Senior Member with 828 posts.
 
Join Date: Sep 2002
21-Aug-2005, 11:05 AM #7
Where is big_image declared: var big_image? If it was never declared, that's your problem.
aewarnick's Avatar
aewarnick aewarnick is offline
Senior Member with 828 posts.
 
Join Date: Sep 2002
21-Aug-2005, 11:11 AM #8
Try this:

var big_image = new Image();
big_image.src = filename;

I'm not sure that will work, but it's worth a try.
DrP's Avatar
DrP DrP is offline DrP has a Profile Picture
Computer Specs
Member with 734 posts.
THREAD STARTER
 
Join Date: Jul 2005
Location: Norwich, UK
21-Aug-2005, 11:23 AM #9
No, it even stopped it working in IE!
The link to the actual page is here:
http://www.cliveportman.co.uk/gallery/gallery.html
Any other ideas?
aewarnick's Avatar
aewarnick aewarnick is offline
Senior Member with 828 posts.
 
Join Date: Sep 2002
21-Aug-2005, 02:42 PM #10
Did you try:

<script type="text/javascript">
var big_image=new Image();
function changeImage(filename)
{
big_image.src = filename;
}
</script>

AND

<script type="text/javascript">
function changeImage(filename)
{
var big_image=new Image();
big_image.src = filename;
}
</script>
DrP's Avatar
DrP DrP is offline DrP has a Profile Picture
Computer Specs
Member with 734 posts.
THREAD STARTER
 
Join Date: Jul 2005
Location: Norwich, UK
22-Aug-2005, 04:44 AM #11
Yes, tried both of those but to no avail. Have, however, solved it 10 min ago. I just changed big_image.src = filename to document.images.big_image.src = filename and it works in both Netscape and Firefox!
Get in there!
DrP
aewarnick's Avatar
aewarnick aewarnick is offline
Senior Member with 828 posts.
 
Join Date: Sep 2002
22-Aug-2005, 08:26 AM #12
Glad you found the problem!

That is why it worked in IE but noone else. IE does not follow standard like they should.
As Seen On

BBC, Reader's Digest, PC Magazine, Today Show, Money Magazine
WELCOME TO TECH SUPPORT GUY!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.


(clock)
THIS THREAD HAS EXPIRED.
Are you having the same problem? We have volunteers ready to answer your question, but first you'll have to join for free. Need help getting started? Check out our Welcome Guide.

Search Tech Support Guy

Find the solution to your
computer problem!




Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools


WELCOME
You Are Using: Server ID
Trusted Website Back to the Top ↑