Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

document.all problem firefox

Status
Not open for further replies.

lynchpin

Programmer
Sep 12, 2005
3
IE
hi all, im having trouble getting through all of this if statement block in firefox. the internet explorer code works. here is the firefox version first:

function disbleTextButton(_varButtonId, _varNewText) {
if(browserType() == "Netscape"){
for (i = 0; i < document.updateForm.getElementsByTagName('*').length; i++) {

obj = document.updateForm.elements;
if (obj.tagName == "INPUT") {
if (obj.type == "image") {
if (obj.name == _varButtonId) {
alert(obj.src);
break;
}
}
}
}
}

i want to get to the alert but cant. the IE explorer code works perfectly. here it is.

for (i = 0; i < document.updateForm.all.length; i++) {
obj = document.updateForm.all;
if (obj.tagName == "INPUT") {
if (obj.type == "image") {
if (obj.name == _varButtonId) {
alert(obj.src);
break;
}
}
}
}

any help would be great.
 
First and foremost suggestion, learn to indent your code. Luckily you're only nested 3 "ifs" deep (4 with the for loop) and you don't have any "elses".

Second, you don't have to use ie and mozilla code. document.getElementsByTagName("input") will work in both browsers, and to my knowledge is fully cross-browser compliant.

-kaht

...looks like you don't have a job, so why don't you get out there and feed Tina.
headbang.gif
[rockband]
headbang.gif
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top