Forum Moderators: open

Message Too Old, No Replies

Simple DHMTL not working in Opera

javascript display change not working in Opera Browser.

         

gncnew

12:53 pm on Sep 11, 2007 (gmt 0)

10+ Year Member



the relevant html:

<div class="extra_sub_item"><a href="#" onclick="timediv('block')">more...</a></div>

The code it points to:

function timediv(disp){
var obj=document.getElementById('timewrap')
var obj2=document.getElementById('timeclose')
wrapcover(disp);
obj.style.display=disp
obj2.style.display=disp
}

I'm trying to take a 'hidden' div with style of 'display="none"' and change it via javascript to "block", and then back again if I click the 'close' link.

This works in IE and FF, but in Opera, it acts like a dead link. Any suggestions?

Trace

2:01 pm on Sep 11, 2007 (gmt 0)

10+ Year Member



I would do it like this;
function showHide(theBlock){
theStyle = document.getElementById(theBlock).style ;
if(theStyle.display == "block") {
theStyle.display = "none";
}
else{
theStyle.display = "block";
}
}

gncnew

2:23 pm on Sep 11, 2007 (gmt 0)

10+ Year Member



would that fix the issue in Opera though? I'm thinking that the process of chaning the display is what's getting confused here. You've put the decision into an 'if' statement rather than where I send the decision via a variable, but is that what's causing Opera to not work?

If you want to see that code in action to see what I'm talking about, the site is [crosswindschurch.net....] The side bar stuff on the right is using this function. In IE and FF the thing works great, but in Opera it's a no go.