FRIHOSTFORUMSFAQTOSBLOGSDIRECTORY
You are invited to Log in or Register a Frihost Account!

Javascript not working IE6 and IE7

 


welshsteve
I have a show/hide function on a form in the page - http://swweb.frih.net/order.html

Depending on which option you choose in the first question, additional fields should appear at the bottom of the form. You can see this working in Firefox and Opera, but in IE6 and IE7 it just will not work, depite me setting my internet options up to allow scripting.

Any ideas at all?

Many thanks in advance
Mosquito.Tyler
I don't know for sure, but IE might have a problem with 'getElementByTagName', why don't you assign ID's and use 'getElementById'. It's worth a shot.
KHO
Ever since the IE7 update, IE no longer handles most javascript, anything having to do with get will not work until a future update. No work arounds that im aware of yet, i know, its a pain, someone at MS decided to "fix" it lol, most web sites are now "broken"
welshsteve
I thought I had it working, but now it's not working again. It would seem you are right. Microsoft are going to continue to lose users to FF and Opera unless they stop being so flaming stubborn.
Aredon
Mosquito.Tyler wrote:
I don't know for sure, but IE might have a problem with 'getElementByTagName', why don't you assign ID's and use 'getElementById'. It's worth a shot.

That is true. Both DOM methods needs to be re-written in IE because it has issues differentiating between ID and NAME.

A correction for that:
Code:

<!--[if IE]>
<script type="text/javascript">
document.getElementById=function(str){
str=new String(str);
var allEls=document.getElementsByTagName("*"),l=allEls.length;
for(var i=0;i<l;i++)if(allEls[i].id==str || allEls[i].getAttribute("id")==str)return allEls[i];
return null;
}

document.getElementsByName=function(str){
str=new String(str);
var myMatches=new Array();
var allEls=document.getElementsByTagName("*"),l=allEls.length;
for(var i=0;i<l;i++)if(allEls[i].name==str || allEls[i].getAttribute("name")==str)myMatches[myMatches.length]=allEls[i];
return myMatches;
}
</script>
<![endif]-->


However the above code will only correct those two DOM methods in IE and I don't see 'em being used anywhere in the code... the only JS I see on the whole page is an external JS file
http://swweb.frih.net/nav.js
which is used only to create the rollover images for the navigation bar at the top:
Home | Order Form | Request Collection | Statustucs | Contact Us

Nowhere in that JS file is there anything related to show/hide functionality for the form. I seems to me that the original poster has omitted the show/hide expand functionality from the script entirely.
welshsteve
Thanks. I'll take a look when I get the chance
Reply to topic    Frihost Forum Index -> Scripting -> Html, CSS and Javascript

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2007 Frihost, forums powered by phpBB.