Author Topic: html javascript question  (Read 1090 times)

wdygfy1

  • Guest
html javascript question
« on: April 13, 2002, 10:50:29 AM »
can somebody explain why I might keep getting an object expected error for the line

< a href=\"#\" onClick=\"changecolor();\">< img src=\"rainbow.gif\">

but without the  spaces after<

with the function written

function changecolor()
{
x++:
if (x == switchcolor.length)
{
x=0;
}
parent.color.document.bgColor = switchcolor

}

and the variables defined as

var switchcolor = new array(\"somecolors\");
var x = 0;

ScriptChic

  • Guest
html javascript question
« Reply #1 on: April 16, 2002, 09:34:21 AM »
Here\'s what I can suggest.
1. Use all lowercase..so...onClick = onclick
2. You seem to have extra \" next to #

With the new XHTML 1.0 standards, which will pretty much replace HTML 4.0 (it\'s being called the HTML 5.0 version..lol) there are 2 issues regarding javascripting.
1. It\'s preferred we use External .js files
2. All lowercase functions.

Have a look  at the new standards at the world wide web consortium, for more info.
HTH, Regards, Debbs