Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Regular Coder
    Join Date
    May 2009
    Posts
    425
    Thanks
    3
    Thanked 62 Times in 61 Posts

    Question Classic IE6 OnClick problem...

    I've been doing some research as to why this doesn't work but to no avail. I'm hoping someone here can lend a hand/brain. I'm relatively new to Javascript.

    This works perfectly in FF and IE7 but not IE6. The very last "tdright" div at the bottom of this list (the item shown in the HTML I've provided is in the middle of 30+ rows of parameters) also gets out of whack in IE6 for some reason. FF is fine, of course.

    Code:
    var ie = (document.all) ? true : false;
    function hideID(objID){
    	var element = (ie) ? document.all(objID) : document.getElementById(objID);
    	element.style.display="none"
    }
    function showID(objID){
    	var element = (ie) ? document.all(objID) : document.getElementById(objID);
    	element.style.display="block"
    }
    function toggleID(objID){
    	var element = (ie) ? document.all(objID) : document.getElementById(objID);
    	if (element.style.display=="none"){
    		element.style.display="block"
    	}
    	else {
    		element.style.display="none"
    	}
    }
    Code:
    				<div class="tdright">: <input type="text" size="1" name="x_label_angle" value="<?php echo $_SESSION['x_label_angle']; ?>"></div>
    				<div class="tdleft"><p class="IEtop4px">Interval</p></div>
    				<div class="tdright">: 
    					<select name="x_label_interval" style="width:80px">
    						<option value="First & Last" onClick="hideID('x_label_other_left');hideID('x_label_other_right');"<?php if ($_SESSION['x_label_interval'] == "First & Last") { ?> selected<?php } ?>>First & Last
    						<option value="Halfway" onClick="hideID('x_label_other_left');hideID('x_label_other_right');"<?php if ($_SESSION['x_label_interval'] == "Halfway") { ?> selected<?php } ?>>Halfway
    						<option value="One-Third" onClick="hideID('x_label_other_left');hideID('x_label_other_right');"<?php if ($_SESSION['x_label_interval'] == "One-Third") { ?> selected<?php } ?>>One-Third
    						<option value="All" onClick="hideID('x_label_other_left');hideID('x_label_other_right');"<?php if ($_SESSION['x_label_interval'] == "All") { ?> selected<?php } ?>>All
    						<option value="Other" onClick="showID('x_label_other_left');showID('x_label_other_right');"<?php if ($_SESSION['x_label_interval'] == "Other") { ?> selected<?php } ?>>Other
    					</select>					
    				</div>
    				<div class="tdleft" id="x_label_other_left" style="display:none"></div>
    				<div class="tdright" id="x_label_other_right" style="display:none">&nbsp;&nbsp;<input type="text" size="1" name="x_label_other_interval" value="<?php if (is_numeric($_SESSION['x_label_interval'])) { echo $_SESSION['x_label_interval']; } ?>"></div>

    Thanks in advance!

  • #2
    Senior Coder
    Join Date
    Jun 2002
    Posts
    1,404
    Thanks
    2
    Thanked 32 Times in 32 Posts
    Too much php to spend time on. Always post served documents (html/css/js) not backend.

    IE doesn't do onclick for Option elements. Use Select.onchange. Also: Opera will sniff positive for 'document.all.' Try

    var isMSIE = /*@cc_on!@*/false;


    Edit: ... actually scratch that. Skip the whole thing, just use .getElementById ...
    Last edited by adios; 06-03-2009 at 03:47 AM.

  • #3
    New to the CF scene
    Join Date
    Aug 2009
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I'd follow this, add it to the head area, I know it's not the perfect answer, but we've got to bring these people into the 21st century...
    <!--[if IE 6]>
    <center><p style="color:#fff;background-color:red">
    <span style="font-weight:bold">NOTICE:</span><br />Because you are using an old browser (Internet Explorer 6),<br >the search box will not display correctly.<br />If you can, <a style="color:#fff;background-color:red"font-weight:bold;text-decoration:underline" href="http://www.mozilla.com/en-US/">Please Update your Browser</a></p></center>
    <![endif]-->
    Last edited by grahamtinley; 08-14-2009 at 12:59 PM. Reason: Better answer.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •