473,830 Members | 2,085 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

about document.image1

Hi, all

I found I can get the img element named with "image1" in a html by
using "document.image 1" with javascript. It's very convenient because
I don't need to use the long method like getElementByNam e etc. I
wonder if this approach is the part of the DOM? I have checked the DOM
specification, but found nothing. Can somebody give me clue? Thanks.

Regards.
Nov 7 '08 #1
3 1302
ha******@gmail. com wrote on 07 nov 2008 in comp.lang.javas cript:
I found I can get the img element named with "image1" in a html by
using "document.image 1" with javascript. It's very convenient because
I don't need to use the long method like getElementByNam e etc. I
wonder if this approach is the part of the DOM? I have checked the DOM
specification, but found nothing. Can somebody give me clue? Thanks.
This is one of the crazy "features" of IE,
not cross-browser safe,
and ever a source of errors in IE itself.

Do not use it on open webpages.

Names are not unique in HTML, IDs are.
It is quite legal to give multiple images the same name.

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Nov 7 '08 #2
ha******@gmail. com wrote:
I found I can get the img element named with "image1" in a html by
using "document.image 1" with javascript. It's very convenient because
I don't need to use the long method like getElementByNam e etc. I
wonder if this approach is the part of the DOM?
It must be part of a DOM, otherwise it would not work. You should be asking
instead whether it is sanctioned by a Web standard. No, it is not. But see
below.
I have checked the DOM specification, but found nothing. Can somebody
give me clue? Thanks.
Read the ECMAScript Language Binding section of the W3C DOM Level 2 HTML
Specification on "objects that implement the HTMLDocument interface" and on
"objects that implement the HTMLCollection interface" to see that

document.images["image1"]

would be standards-compliant. It is also backwards-compatible because the
earliest implementations , that of NN 3.0 and IE 3.0 (the so-called "DOM
Level 0"), already supported it.
PointedEars
--
var bugRiddenCrashP ronePieceOfJunk = (
navigator.userA gent.indexOf('M SIE 5') != -1
&& navigator.userA gent.indexOf('M ac') != -1
) // Plone, register_functi on.js:16
Nov 7 '08 #3
SAM
Le 11/7/08 7:44 AM, ha******@gmail. com a écrit :
Hi, all

I found I can get the img element named with "image1" in a html by
using "document.image 1" with javascript.
It's the old way to get elements, and here : image

But the element must have a 'name' and not only an 'id'.
Take care if you have only ids that only IE will run with this feature.

<img name="image1" id="image1" src blah >

When a browser reads an html file its javascript engine parses the code,
building all the JS trees (the old ones and the DOM).

JS trees :
- document.images
- document.forms (and for each form : document.forms[i].elements)
- document.anchor s
- document.links
- ...
It's very convenient because
I don't need to use the long method like getElementByNam e etc.
usually you have to do :

document.images['image1']
this approach is the part of the DOM?
Absolutely not ! the DOM is the DOM.
You get or set elements via the Document Model Objects

I think javascript DOM functions have been added with version 1.5

I have checked the DOM specification, but found nothing.
Of course :
most of the time it is forbidden to give a 'name' to the elements,
so the DOM doesn't know 'name', or almost not
document.getEle mentsByName('aN ame');
will return the collection of elements named 'aName'.
Can somebody give me clue? Thanks.
search about JavaScript 1.2

--
sm
Nov 7 '08 #4

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

Similar topics

2
7243
by: Sandra Setz | last post by:
Hi, I was wondering if someone could explain to me what the difference is between the width propery of the picture property of an image and the width property of the image itself. I would have guessed that when the stretch property of an image was set to false and an image was assigned to the picture property, that Image1.Picture.Width and Image1.width would be the same. This is not the case.
3
10470
by: Sandra Setz | last post by:
Hi, Is it possible to assign the Picture property of a picturebox to the Picture property of an image control? I use an invisble picturebox to make some changes to a picture, but I want to show the picture in an imagecontrol, since the image is very large and I want to stretch it. But when I execute the following code:
6
1590
by: michaaal | last post by:
Is this the correct way to preload an image...? Var Image1 = new Image() ....And then when I'm ready to use the image I can do this...? Button1.src=Image1.src ....Or am I just telling Button1 to use the same source path as Image1?
5
1367
by: Julia Briggs | last post by:
Is there a <a href="javasc... approach to switch between two images inside a div tag so it doesn't slightly flicker when clicked on, and transitions between images smoothly in Netscape? I can get something to work in IE, but in Netscape there is a slight but obvious flicker. Is there some other way to do this or some solution to making this work? Try my Google referenced images below in IE and Netscape/Firefox and see what I am talking...
0
889
by: Kylin | last post by:
I have a data list and bind it's datasource to a DataSet , about data item , I write a javascript that can open a custom window to show the page , but in dataitem ,I use this function , only get the '<% ', the code in the aspx page like this ? how can I use the javascript function in data item with databinder ? <asp:datalist id="DL_ProductImg" runat="server" Height="106px" RepeatColumns="2" Width="93%">
5
11026
by: Nospam | last post by:
does anyone know if there is anything wrong with this code? <SCRIPT LANGUAGE="JavaScript">document.referrer.indexOf("http://www.example.com") != -1){ document.write("http://www.example.com/image1.jpg")} </SCRIPT> ?
3
3828
by: rkhurana | last post by:
Hi I am writing a JSF application that uses some third party charts. While I can see the chart but the javascript that is supposed to calla function to update chart periodically has a problem. It reports the error in the console - "document.getElementById("image1") has no properties". Pls advice. thanks rupak <?xml version="1.0" encoding="UTF-8"?> <jsp:root version="1.2" ...> ...
2
4039
by: tesa | last post by:
I am not able to figure out how to make this work. I am trying to create a hangman game. I am in a basic javascripting class. I am to only use very basic code as you can see. I am able to use any online resources to help me. I have added alot of comments for what should be happening however is not happening. I also have a teacher that teaches us one way but then asks us to do things he has not taught. I am trying my very best. Any...
4
3817
by: roadiee | last post by:
I am sure this must be common but I can't seem to find how to do it. I have a file structure as follows: php - getimages.php gallery - index.html - image1.jpg - image2.jpg - image3.jpg
0
9793
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
1
10526
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10206
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9315
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7747
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6951
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
4416
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 we have to send another system
2
3960
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3076
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.