Shoutbox

JavaScript IE Incompatiblity - Printable Version

-Shoutbox (https://shoutbox.menthix.net)
+-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58)
+--- Forum: Skype & Technology (/forumdisplay.php?fid=9)
+---- Forum: Tech Talk (/forumdisplay.php?fid=17)
+----- Thread: JavaScript IE Incompatiblity (/showthread.php?tid=62387)

JavaScript IE Incompatiblity by lordy on 07-03-2006 at 04:30 AM

Ok I have this javascript code:

code:
function getElem(id) {
    var divid = document.getElementById(id);
    return divid;
}

function msnAddShow() {
    var form = getElem('hostsu');
    var tblrow = getElem('msnadd');
    var msnAdd = null;
    for (i=0; i<form.msn.length; i++) {
        if (form.msn[i].checked) {
            msnAdd = form.msn[i].value;
        }
    }
    if (msnAdd == "yes") {
        tblrow.style.display = "table-row";
    }
    else {
        tblrow.style.display = "none";
    }
}

Problem is that it doesn't work in IE. What it's meant to do is detect if someone has selected 'yes' to the radio button 'do you have MSN Messenger?' and, if they have, display a text box beneath it for them to enter their MSN address. Live code is at: http://www.teaspoondiner.net/hosting.php?act=signup

It works in all browser BUT IE... is there something I can change for it to work in IE as well as the other browsers? :undecided:
RE: JavaScript IE Incompatiblity by matty on 07-03-2006 at 04:34 AM

Throw the text box for the MSN address into a DIV give it an ID when they click Yes, document.getElementById('id').style.display = ''; if they click no document.getElementById('id').style.display = 'none';

both would be onClicks


RE: JavaScript IE Incompatiblity by kotjze on 07-03-2006 at 04:34 AM

Sorry to be off-topic, but at the top, "This website is best viewed using Mozilla Firefox, on a screen resolution of 1027x768 or higher." I'm sure you mean "1024x768"?

And yeah, I couldn't get it to work in IE/Maxthon either :( I don't see why it wouldn't work though.


RE: JavaScript IE Incompatiblity by lordy on 07-03-2006 at 04:44 AM

quote:
Originally posted by Kotjze
Sorry to be off-topic, but at the top, "This website is best viewed using Mozilla Firefox, on a screen resolution of 1027x768 or higher." I'm sure you mean "1024x768"?

Yeah that's what i meant :P
quote:
Originally posted by Matty
Throw the text box for the MSN address into a DIV give it an ID when they click Yes, document.getElementById('id').style.display = ''; if they click no document.getElementById('id').style.display = 'none';

both would be onClicks
But you can't have individual table rows in a div can you?
RE: JavaScript IE Incompatiblity by matty on 07-03-2006 at 04:57 AM

quote:
Originally posted by lordy
quote:
Originally posted by Matty
Throw the text box for the MSN address into a DIV give it an ID when they click Yes, document.getElementById('id').style.display = ''; if they click no document.getElementById('id').style.display = 'none';

both would be onClicks
But you can't have individual table rows in a div can you?
It will work take this for an example

or this
code:
<script>
    function hideshow(id){
        if (document.getElementById(id).style.display == ''){
            document.getElementById(id).style.display = 'none';
        }else{ document.getElementById(id).style.display = ''; }
    }
</script>

<input id="hideme" />
<input onclick="hideshow('hideme')" type="button" value="hide show"  />

RE: JavaScript IE Incompatiblity by lordy on 07-03-2006 at 04:59 AM

But it would have to hide more than just the text box... did you look at the actual page it's on?


RE: JavaScript IE Incompatiblity by ShawnZ on 07-03-2006 at 05:06 AM

then wrap what you want to hide in a DIV with an ID?


RE: JavaScript IE Incompatiblity by lordy on 07-03-2006 at 05:16 AM

I can't because you can't wrap an individual table row in a div 8-) Is anyone actually looking at the page? :undecided:


RE: JavaScript IE Incompatiblity by ShawnZ on 07-03-2006 at 05:16 AM

then give the table row an ID?


RE: JavaScript IE Incompatiblity by lordy on 07-03-2006 at 05:19 AM

That's what i have now and it's not working in IE... would someone actually look at the source code i have and then answer the question!?


RE: JavaScript IE Incompatiblity by matty on 07-04-2006 at 10:10 PM

Wow like i put in my example, I have a table with rows, the first row has text, the second row has the textbox that is wrapped in a div. You hide and show the div and it works.


RE: JavaScript IE Incompatiblity by lordy on 07-04-2006 at 11:35 PM

yeah but I awant to hide the text AND the text box, which are both  in different table cells on the same row.


RE: JavaScript IE Incompatiblity by matty on 07-05-2006 at 01:17 PM

Is wrapping them both in divs and hiding both too much of a pain?

I mean like is that not something you would consider?