Fw: [Javascript] Fw: hide other divs
Michael Borchers
list at tridemail.de
Wed Apr 12 09:29:40 CDT 2006
>> Yes, I believe your script is failing [in Firefox] because you're
>> executing a string method on a null object for the first div that doesn't
>> have an id. You can fix this simply by adding a test for its existence
>> to the beginning of your Boolean logic:
>>
>> divElementsId = divElements[i].getAttribute("id");
>>
>> if (divElementsId
>> && divElementsId.substring(0,6) == mySubstring
>> && divElementsId != myDiv
>> )
ok, i splitted the if cases for further handling in the function,
but it should still work the way you supposed it, or?
divElementsId = divElements[i].getAttribute("id");
if(divElementsId && divElementsId.substring(0,6) == mySubstring)
{
...
}
IE still works fine but FF again breaks off:(
>
The reason why you don't need getAttribute is simple the id attribute is an
"built in" attribute that mean that all browser will recognise
mydiv.attribute if you create a custom attribute like eg: <div order="1"> at
this point you need getAttribute to pick it up in all browser simply because
some browser won't recognise mydiv.order as an attribute.
<
so i should not use an own attribute?! sorry, didn't wuite get the
solution:/
More information about the Javascript
mailing list