newbie needs little help please

F

Ferd Flintstone

I know this should be really simple but I've tried for hours, can anyone
help?

I'm trying to write JavaScript that will change an image (.gif) when user
clicks a button. Have included all the script its not long. It's coppied
from a book I'm reading to try to teach myself JavaScript but just wont
work. When tested in a Browser the first Image is Displayed correctly
("images/summer-tree") but just get error when button is clicked.

Error is Line 18. Char 1, Object Expected. (its as if the function
"ChangeImage" is not recognised.)
Here is my Code:

<HEAD>

<TITLE>IMG example</TITLE>

<SCRIPT LANGUAGE = Javascipt>

function ChangeImage(){document.img1.src =
"images/winter-tree.gif";document.form1.tree.value = "Can't wait for
Summer.";} // EoFn

</SCRIPT>

</HEAD>

<BODY>

<CENTER><FONT SIZE=-1>

<B>The<I> Ash Tree </I>in Summer &amp; Winter

</FONT>

<P><IMG NAME="img1"

SRC="images/summer-tree.gif" >

<FORM method=" " action=" " NAME="forml">

<FONT SIZE=-2>

<INPUT TYPE=button NAME="tree"

VALUE="The Winter look"

onClick="ChangeImage()">;

</FONT>

<BR>

</FORM>

<ADDRESS>Image-Ex14.htm</ADDRESS>

</CENTER>

</BODY>



Thanks for any help

Please reply to group

Fred
 
M

Mike

LANGUAGE = Javascipt

should be

LANGUAGE = Javascript

you forgot the "r". now the browser will find the method

Mike
 
F

Ferd Flintstone

Mike said:
LANGUAGE = Javascipt

should be

LANGUAGE = Javascript

you forgot the "r". now the browser will find the method

Mike

Thanks, Lesson Learnt, will always check my spelling before I look for
anything else.
Fred
 
T

Thomas 'PointedEars' Lahn

Mike said:
LANGUAGE = Javascipt

should be

LANGUAGE = Javascript

Yes and no. Yes, the latter spelling is correct.
No, the `language' attribute is deprecated and using
it without the `type' attribute is invalid HTML 4.

Use

<script type="text/javascript">

instead.
[Top post]

Please do not waste scarce and precious resources.


PointedEars
 
F

Fabian

Thomas 'PointedEars' Lahn hu kiteb:

[Top post]

Please do not waste scarce and precious resources.

In the early days of the Internet, such resources may well indeed have
been scarce. However, given the volume of spam email now in existance,
and teh fact that this is an issue of sequencing and not of total
volume, wasting resources is, at most, a non-issue.

However, top posting should still be discouraged, as the sequencing
issue makes it hard to read for most humans, who are, I assume, your
intended audience.
 
R

rf

[post rearranged]
LANGUAGE = Javascipt

should be

LANGUAGE = Javascript

you forgot the "r". now the browser will find the method

Nope. It should be

<script type="text/javascript">

Cheers
Richard.
 
T

Thomas 'PointedEars' Lahn

Fabian said:
Thomas 'PointedEars' Lahn hu kiteb:
[Top post]

Please do not waste scarce and precious resources.

In the early days of the Internet, such resources may well indeed have
been scarce. However, given the volume of spam email now in existance,
and teh fact that this is an issue of sequencing and not of total
volume, wasting resources is, at most, a non-issue.

It is not at all. Never conclude from your (good) conditions to the
majority of users.

I have a huge number of newsgroups and postings to read, and I have
a real life. I am downloading newsgroup messages to disk because it
would be too expensive to read them on-line, but I have to download
them through my 56k modem. For me, (free) time, disk space and
bandwidth are scarce resources and thus precious ones. Those who want
their postings to be read by me better not waste those resources. May
it be intentional or just thoughtlessness, the result is the same.

I am only one person. I doubt I am the only one.
However, top posting should still be discouraged, as the sequencing
issue makes it hard to read for most humans, who are, I assume, your
intended audience.

Full ACK


PointedEars
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,534
Members
45,007
Latest member
obedient dusk

Latest Threads

Top