473,473 Members | 1,949 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

FireFox called an IMG object

QA
It works fine in IE and Opera, but in Firefox, I had to put the <img
name=something src> within a <form></form>

it seems to me in IE/Opera, i can do

document.imagename.src
in Firefox
I have to do
document.formname.imagename.src

Is that right? Anyway to get around this?
Jul 23 '05 #1
3 2022
On Fri, 10 Sep 2004 08:23:01 GMT, QA <QA@alexa.com> wrote:
It works fine in IE and Opera, but in Firefox, I had to put the <img
name=something src> within a <form></form>

it seems to me in IE/Opera, i can do

document.imagename.src
in Firefox
I have to do
document.formname.imagename.src

Is that right? Anyway to get around this?


To be honest, I don't see how that would help. Very odd if it does. The
better solution would be to use the images collection. Try:

document.images['imagename'].src

If imagename is a variable containing the name, remove the quotes.

Good luck,
Mike

--
Michael Winter
Replace ".invalid" with ".uk" to reply by e-mail.
Jul 23 '05 #2
QA
It works fine in IE and Opera, but in Firefox, I had to put the <img
name=something src> within a <form></form>

it seems to me in IE/Opera, i can do

document.imagename.src
in Firefox
I have to do
document.formname.imagename.src

Is that right? Anyway to get around this?


To be honest, I don't see how that would help. Very odd if it does. The
better solution would be to use the images collection. Try:

document.images['imagename'].src


What about document.getElementById('imagename')?
I am not sure if getElementById is cross browser too. I am very confused
about how the object works in different browers. Especially window and
document. I feel they are the same thing, but sometimes they are different.
windows.href, document.location, document.location.href, ....
Jul 23 '05 #3
On Sat, 11 Sep 2004 02:40:36 GMT, QA <QA@alexa.com> wrote:
It works fine in IE and Opera, but in Firefox, I had to put the <img
name=something src> within a <form></form>

it seems to me in IE/Opera, i can do

document.imagename.src
in Firefox
I have to do
document.formname.imagename.src

Is that right? Anyway to get around this?
To be honest, I don't see how that would help. Very odd if it does. The
better solution would be to use the images collection. Try:

document.images['imagename'].src


What about document.getElementById('imagename')?


It depends what you're trying to access. If you're attempting to retrieve
a reference to an image, use the images collection as I've shown above.
Not only is part of the current Document Object Model (DOM) standards, but
it is supported by browsers at least as far back as NN4.

document.getElementById should only be used to access elements with id
attributes, and there are no other ways of referencing that data. This is
because whilst a standard method supported on the vast majority of modern,
scriptable browsers, it's not supported by all by older browsers.
I am not sure if getElementById is cross browser too. I am very confused
about how the object works in different browers. Especially window and
document. I feel they are the same thing, but sometimes they are
different.
The window and document objects are entirely different.

The window object (also the frame object) is the global object. Global
variables, functions and host objects are properties of this object. The
formal standards for this object also specify few of the properties
commonly used; they have become de facto standards.

The document object is the root object in the document tree. All elements
(and other nodes) used in your pages are a child of this object.
windows.href, document.location, document.location.href, ....


I don't believe any of those are correct. You're thinking of location.href
(or window.location.href, but it's exactly the same thing). The location
object is one of those de facto objects, but it is well supported.

Mike

--
Michael Winter
Replace ".invalid" with ".uk" to reply by e-mail.
Jul 23 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Chris Smith | last post by:
This is a bit of a weird problem. Unfortunately, I can't reproduce it in a simple example, so I can only poke it out there and see if anyone has seen something similar. I have a script that...
4
by: Stuart Perryman | last post by:
Hi, I have the following code which works just fine in IE6 but not in Firefox. It is an extract of several table rows each with an individual form. It is generated by php. <form...
5
by: Donius | last post by:
I am making some popup windows, and then trying to load content into them. It can be as few as two windows, and as many as 15 or so. I'm running into a problem where firefox cannot find the...
5
by: Martin Chen | last post by:
I have a frame set (as per MS FrontPage 2000). It has a contents and a main frame. The contents frame has a menu bar written with with javascript (in the context of a table). In IE6.1 everything...
21
by: briggs | last post by:
<html> <head> <script> /* AddChild */ function ac() { var c; var p = document.getElementById("p"); for (var i = 0; i < 5; i++) { c = document.createElement("DIV"); // Create 'div' element.
2
by: Pugi! | last post by:
I would like to obtain the the position of backgroundimage of a div because I use it for animation. The following code works for Internet Explorer (takes the else if) and returns positionx '10px'...
3
by: jon | last post by:
Hello, I've had long standing code that runs in IE, that I'm testing with firefox unsuccessfully now. The problem seems to be that images that I dynamically create don't fire their onload event...
2
by: Serena | last post by:
I have a problem whit this script. It is compatible with IE but isn't with Firefox. The error are: 1) "e has no properties" at----- "if(e.pageX || e.pageY) {" 2) "document.getElementById()"...
1
by: Joey | last post by:
asp.net 2/C#/VS2005 I have a webform that contains gridview that is databound to a dataset maintained in session state. Users can enter values into textboxes and add to the grid. For each row in...
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
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.