473,395 Members | 1,999 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.

Refrencing Images

Anyone know how to refrence images? like GetElementByID except for
images. I alread tried ...ByID ...ByName ...ByValue GetImageBy[previous
ones].

Jul 23 '05 #1
26 1350
<img ... id=foo name=foo />

document.images[0] === document.images[ 'foo' ] ===
document.getElementById( 'foo' );

Jul 23 '05 #2
On 22/05/2005 06:50, Random wrote:
<img ... id=foo name=foo />

document.images[0] === document.images[ 'foo' ]
Assuming 'foo' is the first image in the document, otherwise the index
(0) will be different.
=== document.getElementById( 'foo' );


Even when an id attribute value is present on an image in a HTML
document, it is preferable to use the images collection above. It is
supported on more user agents and is self-documenting.

Mike

--
Michael Winter
Replace ".invalid" with ".uk" to reply by e-mail.
Jul 23 '05 #3
hands[ 1 ].add( new Thumb( { direction: 1 } ) );

or, rather,

hands[ 'right' ].add( new Thumb( { direction: 'up' } ) );

Jul 23 '05 #4
Ok thx, i'll try them as soon as i can

Jul 23 '05 #5
i'm wondering, can i put in stead of a # in /document.images[0]/, can i
put a variable /document.images[myimg]/?

Jul 23 '05 #6
never mind that, new problem: why isn't this working?
document.images[imgfile] === document.images[currX] ===

document.getElementById(currX).src="man.jpg";

Jul 23 '05 #7
LOL, i keep solving my own problems (needed 3 ===) thx for all your
help Micheal , "Random"

Jul 23 '05 #8
HTML-JSClub wrote:
LOL, i keep solving my own problems (needed 3 ===) thx for all your
help Micheal , "Random"


Now all we have to do is manage to teach you how to quote and reply
properly.

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Answer:It destroys the order of the conversation
Question: Why?
Answer: Top-Posting.
Question: Whats the most annoying thing on Usenet?
Jul 23 '05 #9
sry i had asked a question but when i solved it i deleted it off the
thread, i thought i had deleted the one you just quoted too.
the question was " Why isnt this working? document.images[0] ===
document.images[ 'foo' ] ===
document.getElementById( 'foo' ). src = 'image.jpg' "
The answer was that i needed 3 === after .src
sry for the confusion

Jul 23 '05 #10
On 24/05/2005 06:02, HTML-JSClub wrote:
never mind that, new problem: why isn't this working?
document.images[imgfile] === document.images[currX] ===
document.getElementById(currX).src="man.jpg";

All you want is:

document.images[currX].src = 'man.jpg';

In an earlier post where Random wrote:
<img ... id=foo name=foo />

document.images[0] === document.images[ 'foo' ] ===
document.getElementById( 'foo' );


the point was that you could use

document.images['foo'] or,
document.getElementById('foo')

to refer to it. If that image was the n'th image in the document, you
could also use

document.images[ <n> ]

instead. The intent wasn't for you to use all of them.

Mike

--
Michael Winter
Replace ".invalid" with ".uk" to reply by e-mail.
Jul 23 '05 #11
HTML-JSClub wrote:
sry i had asked a question but when i solved it i deleted it off the
thread, i thought i had deleted the one you just quoted too.
the question was " Why isnt this working? document.images[0] ===
document.images[ 'foo' ] ===
document.getElementById( 'foo' ). src = 'image.jpg' "
The answer was that i needed 3 === after .src
sry for the confusion


And you still missed the most important part of what I posted.

<quote>

Now all we have to do is manage to teach you how to quote and reply
properly.

</quote>

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Answer:It destroys the order of the conversation
Question: Why?
Answer: Top-Posting.
Question: Whats the most annoying thing on Usenet?
Jul 23 '05 #12
OK I'M SORRY!!!! and I finally get it thanks to Micheal and if i'm
still missing the point than i have NOOOOOO idea what you're talking
about.

Jul 23 '05 #13
HTML-JSClub wrote:
Randy Webb wrote:
HTML-JSClub wrote:
Randy Webb wrote: <snip> Now all we have to do is manage to teach you
how to quote and reply properly. <snip>sry for the confusion
<snip>And you still missed the most important part of what I posted.
<snip> ... if i'm still missing the point than i have
NOOOOOO idea what you're talking about.


Concentrate on the words "how to quote".

Richard.
Jul 23 '05 #14
o....k..... i dont remember quoting anything. And now I have a
question: in switch statements can i have it like:
case str1:

or does it have to be a string or number?

Jul 23 '05 #15
ooooooooooohh!!! OK i get it now. When quoting someone i add <quote>
and </quote> around it. right?

Jul 23 '05 #16
"HTML-JSClub" <fa******@barsoum.com> writes:
ooooooooooohh!!! OK i get it now. When quoting someone i add <quote>
and </quote> around it. right?


No. Look what most other people do in this group:

You should quote(!) enough of the post you are responding to, for
giving an understandable context for your answer. How much is enough
is debatable, but everything is often too much (except, as here, where
the message wasn't very large) and nothing is always too little. You
have consistently quoted nothing.

You should put your reply below the quote that it refers to. If you
reply to several points of a message, quote and answer each in this
way.

Quotes must be attributed. While there are raging debates about how
much an attribution needs, it should be sufficient for the reader
to recognize the poster being quoted, if the reader is familiar
with that poster already. My newsreader software uses a very short
version, which I find adequate (although a date would probably be
good).

Quotes should be marked by having their lines prefixed with "> ".
When quoting quotes, the space is not necessary, so a quoted quote
could be prefixed by ">> ". Together with the attribution, the
"quoting level" makes it possible to see who wrote what.

And don't use HTML, so no <quote>-tags.

Most of these, by now age old, formatting conventions would be taken
care of if you used a dedicated news client for reading newsgroups,
and not Google Groups, which, as a simple web interface, is not as
full featured. Dedicated newsreaders include Outlook, Outlook Express,
XNews, Agent and Thunderbird (and many others).

/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html>
'Faith without judgement merely degrades the spirit divine.'
Jul 23 '05 #17
HTML-JSClub wrote:
o....k..... i dont remember quoting anything. And now I have a
question: in switch statements can i have it like:
case str1:

or does it have to be a string or number?


Isn't it easier to try it and find out, rather than asking a dour bunch
of passive-aggressive scripters who are more likely to harp on the form
of your message than give you a meaningful response?

I promise it won't fry your motherboard, though it may insult your
mother.

Jul 23 '05 #18
HTML-JSClub wrote:
o....k..... i dont remember quoting anything. And now I have a
question: in switch statements can i have it like:
case str1:


or does it have to be a string or number?


Its easy enough to test. But yes, you can reference variables in your
case statement.

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Jul 23 '05 #19
Random wrote:
HTML-JSClub wrote:
o....k..... i dont remember quoting anything. And
now I have a
question: in switch statements can i have it like:
>case str1:
^ ^ or does it have to be a string or number?
Isn't it easier to try it and find out,


Trying things is often good, but so is looking at the documentation
(specifically the algorithms in ECMA 262).
rather than asking a dour bunch of passive-aggressive
scripters who are more likely to harp on the form of
your message than give you a meaningful response?

<snip>

'passive-aggressive' is an interesting label. It is impossible for the
recipient to object to it, or ignore, it without seeming to confirm the
diagnosis; useful when you have nothing but rhetoric to throw at an
argument.

The deal is; the posting conventions (including posting minimal trimmed
quotes of preceding messages, properly attributed, to provide a context
for responses) are for the benefit of the reader. In a one-to-many
communication medium like Usenet the convenience of the reader is
paramount as they significantly outnumber the author, and in most cases
the reader is the person who may be providing the answer, so it is
expedient to pander to their convenience.

Experienced participants in newsgroups don't like having to back-track
through threads to re-assemble the context of messages, or scroll
through yards of needlessly quoted material to see if there happens to
be a comment following it (and top-posting is the main cause of that).
But (not so) coincidentally it is the experienced participants who have
seen it all and know the answers to the questions asked. The upshot is
that the more experienced, and so likely more knowledgeable,
participants in the group are in a position to reduce the amount of
their time that is wasted by not answering the questions of people who
will not follow the Usenet posting conventions (or not assisting the
people who are answering questions but could benefit form a better
understanding), by not responding to their questions (or, in extremes,
killfileing them).

Obviously it is a bit unfair to dismiss people nothing more than what is
probably just ignorance of the conventions that they should be
following. So we provide a FAQ, which includes and outline of the
conventions, a reference to a detailed explanation, and a warning of the
consequences of ignoring them. One of the Usenet conventions is the
people wishing to participate in technical newsgroups that provide a FAQ
should read the FAQ prior to posting, but there is an obvious catch-22
in that for those initially ignorant of the conventions.

On the other hand people who need to be spoon-feed all of their
information, who cannot research anything and find out for themselves,
don't tend to be very interesting to talk to. So the normal practice is
to, more or less politely, initially refer people to the FAQ, suggesting
that they read it (and the resources that it refers to). And then to
make comments about the particular aspects of posting style in which
they are deficient. These represent the hints that a worthwhile
individual will pick up on. If they haven't picked up on them after a
couple of attempts then they are probably best dismissed form thought,
though some more charitable contributors may occasionally make the
effort of providing an additional detailed explanation of the
conventions (but doing that for everyone is not a realistic
expectation).

I notice that you got the idea quite quickly. One advisory comment and a
little observation and you are very close to producing perfectly formed
newsgroup postings, and that with the significant drawback for posting
from a poor example of a web interface instead of a newsreader. Just fix
that miss-attribution in your quote markers (the '> >', where it should
have just been '>'), and maybe use a clearer indicator of your edits,
and you will be 100%.

Richard.
Jul 23 '05 #20
Does this type of commenting happen in every topic or did you all
decide to waste a bunch of your time here writing away at some useless,
off-topic subject?
'Cause this isn't funny; I'm trying to make a website so I can show it
off to interviewers and here you are explaining to me how to properly
quote and a bunch of other stuff not related to this topic or, as a
matter of fact, to this group. There's a whole Google Group called
'miscilaneous' and it's there for a reason.

Jul 23 '05 #21
Richard Cornford wrote:
Random wrote:

....
rather than asking a dour bunch of passive-aggressive
scripters who are more likely to harp on the form of
your message than give you a meaningful response?

<snip>

'passive-aggressive' is an interesting label. It is impossible for the
recipient to object to it, or ignore, it without seeming to confirm the
diagnosis; useful when you have nothing but rhetoric to throw at an
argument.


It was really intended to be illustrative to the poster of the message
to which I was replying as well as mildly amusing to myself and others
who can take a little self-deprecating humour. Didn't intend to elicit
a dissertation-- sorry for prompting that much effort (seriously).

And as 'JSClub' has already noted, it wasn't funny either. To each
their own. Apparently it wasn't illustrative, either.

Ah well.

I'll slap my own wrist.

Jul 23 '05 #22
HTML-JSClub wrote:
Does this type of commenting happen in every topic or
did you all decide to waste a bunch of your time here
writing away at some useless, off-topic subject?
It isn't necessarily a waste of time to determine with certainly whether
it is worth anyone's time trying to help someone. Thanks for making that
clear.
'Cause this isn't funny; I'm trying to make a website so
I can show it off to interviewers
You have just made it clear that you cannot take a hint, cannot research
a simple subject for yourself and cannot be warned is as many words, so
you are probably not employable enough to be worrying about interviews.

<snip> ... . There's a whole Google Group called
'miscilaneous' and it's there for a reason.


What does google have to do with Usenet?

Richard.
Jul 23 '05 #23
Richard Cornford wrote:
[explanation]


While this is/was certainly completely off-topic, I cannot resist to
congratulate you on this one in public. Well done, I could not have
explained it any better. Despite what anybody else may state about
it, it was more than worth reading, even for a regular.

Sometimes I think we need more of this in the FAQ, but then, as you
already pointed out, many people still don't bother to read the FAQ.
It's a chicken-and-the-egg problem that sometimes makes me wonder if
one should just earn something like a Usenet driver's license before
being allowed to post to a Usenet newsgroup.
Regards,

PointedEars
Jul 23 '05 #24
I see that there is some kind of joined forum thing between Usenet and
Google, cause I'm reading and replying to your messages using Google
Groups. Appearantly most of you are using Usenet.

Jul 23 '05 #25
"HTML-JSClub" <fa******@barsoum.com> writes:
I see that there is some kind of joined forum thing between Usenet and
Google, cause I'm reading and replying to your messages using Google
Groups. Appearantly most of you are using Usenet.


More precisely: Google has an interface to Usenet. You too are using
Usenet. Where many of us are using dedicated news client programs,
you are using a news client that runs through a browser. The end
result is the same, you can read and post messages to Usenet groups.

With that in mind, using Google Groups is no excuse for not following
Usenet etiquette ... which includes quoting selected parts of the
message you are replying to in order to give your message context :)
Good luck :)
/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html>
'Faith without judgement merely degrades the spirit divine.'
Jul 23 '05 #26
HTML-JSClub wrote:
I see that there is some kind of joined forum thing between Usenet and
Google
No there is not.
cause I'm reading and replying to your messages using Google
Groups.
Yep, you can read/post to Usenet using Google Groups. But Google Groups
is but an archive/interface to Usenet, it is not an independent forum.
Had you read the FAQ, which has been recommended to you more than once,
you would know this.
Appearantly most of you are using Usenet.


So are you, you just chose a crappy interface to try to use it from.

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Jul 23 '05 #27

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

Similar topics

7
by: Wayne | last post by:
I have a script that uses filesystemobject that reads files from a given path, in my case images. It is running on a server that is 2000 adv svr w/ all current patches. The script prior to some...
11
by: Penelope Baker | last post by:
Greetings: I cannot seem to get IE 6.0 to pre-cache my rollover images. Every time the user rolls over a link, it rereads it from the server, even though it is well into the cache by that time....
2
by: Julie | last post by:
Hi, I'm trying to change images on a website without reloading the whole page and use the following code to preload the images: var preloadFlag = false; function preloadImages() { if...
3
by: Simon | last post by:
This problem has been driving me mad for months.... Seen a few posts on forums about it but no answers... No mention on MSDN etc. XP Pro SP1, VS.NET (c#) .Net framework 1.1, IIS 5.1. In a...
0
by: NathanV | last post by:
I have a class that I'm refrencing thats in a class library. VS.NET gives me an error when calling which states, 'Namespace does not exist in the class or namespace...'. The page compliles and...
4
by: Bernie Raffe | last post by:
When I change the 'cookieless' flag in the WebConfig file to true, everything works fine on my local PC, but the images fail to appear when using the remote server. I specify my images...
4
toxicpaint
by: toxicpaint | last post by:
Hi, can anyone give me a hand. I'm currently displaying 4 random images at the top of a page. I did this using an array of 35 pictures and then writing them to page. The problem I have is that in...
5
by: remon87 | last post by:
I need some help. I have javasript that creates the submenu but it works if I have a text with css. I need it to do the same with a roll over images. so when I click on the image the submenu...
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: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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.