Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Hide item and attributes of another item.

Status
Not open for further replies.

ArtWerk

Programmer
Jul 31, 2006
66
US
This works no problem on Firefox, but do I need to do something to get it to work in IE. It only hides the <span> item, but doesn't get rid of the border and background color.

JAVASCRIPT:
Code:
function hideBox(id){
	document.getElementById(id).style.backgroundColor = "";
	document.getElementById(id).style.border = "none";
	document.getElementById("hider").style.display = "none";
}

SPAN
Code:
<span id="hider" class="noprint"> - <a onclick="hideBox('downtown');" class="jsLink">hide highlight box</a></span>

DIV
Code:
<div id="downtown" style="float:left; padding: 5px; border:1px solid #CDCF00; background-color:#FEFFBF;" class="address">
 
Try using single quotes in you javascript. And, by the way, to hide the div, it enough just to toggle the display property:

Code:
function hideBox(id){
    document.getElementById("hider").style.display = 'none';
}

Regards
 
... sorry, it should've been like this

Code:
<span id="hider" class="noprint"> - <a href="javascript:hideBox('downtown');" class="jsLink">hide highlight box</a></span>

... and ...

Code:
function hideBox(id){
    document.getElementById(id).style.display = [COLOR=red]'[/color]none[COLOR=red]'[/color];
}
 
... sorry -again. Forget what I wrote. Rubbish. Better if I just go to bed now ;-)
 
well, 1. i don't want to hide the DIV, only the SPAN. The DIV has text and I just want to get rid of the border and background color. The SPAN is getting hidden fine in both IE and FF, but the DIV doesn't do anything in IE. I will try single quotes, but I don't think that's going to do much.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top