Hi,
I’m quite new to javascript (but I’m getting better)
My problemn is following :
I got a page with a form and two <select> tags within. Second is updated regarding actions and value on the first one
the first
[CODE]echo “<select STYLE=’width: 100px;’ name=’avatar_class’ size=’1′ onchange=’showValue(this);’ onmouseup=’showValue(this);’>”;
the second
[CODE]echo “<select name=’avatar_spec’ size=’1′ STYLE=’width: 100px;’ disabled>n”;
Begin of function is :
[CODE]function showValue( b )
{ var f = b.form;
var sel = f.elements[‘avatar_class’];
var spec = f.elements[‘avatar_spec’];
spec.disabled=false;
RemoveAllSpec(spec);
………….
This works fine upon change or mouseup on the first select tag.
But….
I would like this function to run at page load. I then put within my code, at the end of the file :
[CODE] echo “<SCRIPT LANGUAGE=’javascript’>”;
echo “showValue(this);”;
echo “</SCRIPT>”;
Function is called, but the “this” do not seem to be the same as when function called by events on first tags.
Firebug returns me that error
[CODE]f has no properties
[Break on this error] var sel = f.elements[‘avatar_class’];
Wath am I doing wrong ?
Thx in advance,