473,395 Members | 1,422 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,395 software developers and data experts.

Image() constructor?

Hey all,

I am trying to figure out what the constructors for the Image object are.

I have figured out that in IE and Mozilla, the Image object, and the
HTMLImageElement are the same, from a property perspective at least, but
what is the constructor for the Image object?

I know that I can call the following constructors, but are there others?

Image()
Image(int x, int y)

I could not find any actual spec for this.

Brian

Jul 20 '05 #1
3 4871
Brian Genisio wrote:
Hey all,

I am trying to figure out what the constructors for the Image object are.

I have figured out that in IE and Mozilla, the Image object, and the
HTMLImageElement are the same, from a property perspective at least, but
what is the constructor for the Image object?

I know that I can call the following constructors, but are there others?

Image()
Image(int x, int y)

I could not find any actual spec for this.

Brian

Well, I found this...
http://www.powermct.co.kr/teched/ecma/image.html

It says that the constructor is :

Image([width,] [height]);

But, this is a page claiming to be an ECMAScript reference, though the
ECMAScript spec does not talk about images... it is browser thing... so
I do not trust this reference.

Any other ideas?
Brian

Jul 20 '05 #2


Brian Genisio wrote:

I am trying to figure out what the constructors for the Image object are.


Well, if you write Image() (as you do in the subject) then you are
probably talking about a constructor function itself, that available in
client side JavaScript for the purpose of image preloading since Netscape 3:

http://devedge.netscape.com/library/...nce/image.html

In general, for host objects, don't expect constructor functions to be
exposed at all or the same in all browsers.

And nowadays, with DOM supporting browser, if you want to create an
<img> element object use document.createElement('img') as
document.createElement is a factory function to create any element from
its tagname.

--

Martin Honnen
http://JavaScript.FAQTs.com/

Jul 20 '05 #3
Martin Honnen wrote:


Brian Genisio wrote:

I am trying to figure out what the constructors for the Image object are.

Well, if you write Image() (as you do in the subject) then you are
probably talking about a constructor function itself, that available in
client side JavaScript for the purpose of image preloading since
Netscape 3:

http://devedge.netscape.com/library/...nce/image.html

Yeah, that is what I am looking for. I am implementing a DOM, so I
need to make sure the Image() constructor is avaialable to the user, and
I wanted to make sure I was not missing any constructor capabilities.

In general, for host objects, don't expect constructor functions to be
exposed at all or the same in all browsers.

In that case, I will assume the ([width,] [height]) constructor... that
should be safe. Any other constructor the user would use, I would not
need to support.
And nowadays, with DOM supporting browser, if you want to create an
<img> element object use document.createElement('img') as
document.createElement is a factory function to create any element from
its tagname.


My DOM supports document.createElement('img') already, so I am cool there.

Thanks,
Brian

Jul 20 '05 #4

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

Similar topics

8
by: Phil Powell | last post by:
I borrowed this code from a source: for($a=0;$a<imagecolorstotal ($image_id);$a++) { $color = imageColorsForIndex($image_id,$i); $R=.299 * ($color)+ .587 * ($color)+ .114 * ($color);...
3
by: dave | last post by:
Hello there, I am at my wit's end ! I have used the following script succesfully to upload an image to my web space. But what I really want to be able to do is to update an existing record in a...
6
by: Ross M. Greenberg | last post by:
If I have a variable named 'fred', the contents looking like this: '/gif/picture1.gif', how can I display that image? Thanks! Ross
4
by: Matthias Spiller | last post by:
Hi, following problem. I'm writing an Image class and want to use templates: .... template<class TType, int TLayers> class Image { public: Image();
9
by: Karl Burrows | last post by:
I am working on a Website for a non-profit group and for some reason I have one link that doesn't want to cooperate. All the image links work fine with the onmouseover and onmouseout script except...
3
by: Marcin Kowalewski | last post by:
Hi I've got a stupid problem with code below : using System; using System.Drawing; .... public class CsrcImage :Image { public CsrcImage() { //
10
by: Arno | last post by:
Hi, I want to convert a byte to a Image. I read in a newsgroup that the best way is to use a MemoryStream. I tried it, but I get always a Exception while creating the Image(An unhandled...
1
by: Martijn Mulder | last post by:
At startup my application loads an image from a file from disk. If the file is not there, I still need a valid System.Drawing.Image object but I don't know how to get one. //class MyImage...
7
by: howardk | last post by:
I'm writing some code that loads a number of images, using the standard mechanism of assigning a src url to a newly constructed Image object, thus invoking the image-load operation. On a successful...
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:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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,...
0
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...

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.