473,856 Members | 1,683 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 1305
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
7246
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
10471
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
1593
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
1369
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
890
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
11031
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
3831
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
4040
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
3818
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
9755
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10692
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10770
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
9526
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
7928
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
5754
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5954
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4567
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
3
3194
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.