View Full Version : Classic IE6 OnClick problem...

06-02-2009, 10:04 PM
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.

var ie = (document.all) ? true : false;
function hideID(objID){
var element = (ie) ? document.all(objID) : document.getElementById(objID);
function showID(objID){
var element = (ie) ? document.all(objID) : document.getElementById(objID);
function toggleID(objID){
var element = (ie) ? document.all(objID) : document.getElementById(objID);
if (element.style.display=="none"){
else {

<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
<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! :)

06-03-2009, 04:37 AM
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 (http://dean.edwards.name/weblog/2007/03/sniff/)

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

... actually scratch that. Skip the whole thing, just use .getElementById ...

08-14-2009, 01:44 PM
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... :rolleyes:
<!--[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>