Gossamer Forum
Home : General : Internet Technologies :

div hiding issues

Quote Reply
div hiding issues
Hi,

Can anyone suggest why this isn't working in FF?

Code:
<script>
function showhide(id){

if (document.getElementById){
obj = document.getElementById(id);
if (obj.style.display == "none"){
obj.style.display = "";
} else {
obj.style.display = "none";
}

if (id != 'title_div') { title_div.style.display = "none"; }
if (id != 'subheader_div') { subheader_div.style.display = "none"; }
if (id != 'lead_div') { lead_div.style.display = "none"; }
if (id != 'video_div') { video_div.style.display = "none"; }
if (id != 'testimonials_div') { testimonials_div.style.display = "none"; }
if (id != 'header_div') { header_div.style.display = "none"; }
}
}
</script>

Basically, it all works - appart from the last few lines.

Code:
if (id != 'title_div') { title_div.style.display = "none"; }

..gives:

Quote:
Error: title_div is not defined
Source File: http://www.site.com/cgi-bin/add_more_info.cgi?ID=18
Line: 71

Guessing I'm using the wrong format with this bit:
Code:
title_div.style.display

...any suggestions? (I've had a look on google, but couldn't find anything helpful :/)

Cheers

Andy (mod)
andy@ultranerds.co.uk


IMPORTANT: I've now moved to ultranerds.co.uk, and the .com will no longer work!
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package (plugins total "value" $3,325 & rising, for just $350)| GLinks ULTRA Package PRO (plugins total "value" $5,625 & rising, for just $500)
Support Forum | Links SQL Plugins | DMOZ Dumps | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Compare our different Plugin packages *new* Free CSS Templates
Quote Reply
Re: [Andy] div hiding issues In reply to
It's as the error says - title_div is not defined. Did you initialise it (in your case, did you set the html element to it)?

Adrian
Quote Reply
Re: [brewt] div hiding issues In reply to
Hi,

Do you mean do I have the code for it?
Code:
<div id="title_div" style="display: none;">
<input type="text" name="Title" size="30">
</div>

Not sure if it makes a difference, but this is AFTER the show/hide link;

Code:
<a href="#" onclick="showhide('title_div');">Title</a></a> (<a href="#d">what is this?</a>)

..TIA!

Andy (mod)
andy@ultranerds.co.uk


IMPORTANT: I've now moved to ultranerds.co.uk, and the .com will no longer work!
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package (plugins total "value" $3,325 & rising, for just $350)| GLinks ULTRA Package PRO (plugins total "value" $5,625 & rising, for just $500)
Support Forum | Links SQL Plugins | DMOZ Dumps | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Compare our different Plugin packages *new* Free CSS Templates
Quote Reply
Re: [Andy] div hiding issues In reply to
Code:
if (id != 'title_div') { document.getElementById("title_div").style.display = "none"; }

For things like that I use prototype.js. With prototype.js included it should look like:

Code:
if (id != 'title_div') { $("title_div").hide(); }
Quote Reply
Re: [neves] div hiding issues In reply to
Hi,

Thanks for the reply. Whats "prototype.js" ??

Cheers

Andy (mod)
andy@ultranerds.co.uk


IMPORTANT: I've now moved to ultranerds.co.uk, and the .com will no longer work!
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package (plugins total "value" $3,325 & rising, for just $350)| GLinks ULTRA Package PRO (plugins total "value" $5,625 & rising, for just $500)
Support Forum | Links SQL Plugins | DMOZ Dumps | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Compare our different Plugin packages *new* Free CSS Templates
Quote Reply
Re: [Andy] div hiding issues In reply to
It's a javascript framework:

http://www.prototypejs.org/

One advantage is you dont have to think about any browser compatibilities ... more or less.
Quote Reply
Re: [neves] div hiding issues In reply to
Hi,

Thanks, works a charm Smile

Cheers

Andy (mod)
andy@ultranerds.co.uk


IMPORTANT: I've now moved to ultranerds.co.uk, and the .com will no longer work!
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package (plugins total "value" $3,325 & rising, for just $350)| GLinks ULTRA Package PRO (plugins total "value" $5,625 & rising, for just $500)
Support Forum | Links SQL Plugins | DMOZ Dumps | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Compare our different Plugin packages *new* Free CSS Templates
Quote Reply
Re: [Andy] div hiding issues In reply to
Hi Andy,

This should be the missing tag div of 'title_div'. Something like <div id="title_div"...>

Cheers,

Dat

Scripts installation and plugin creation
Plugins
Quote Reply
Re: [tandat] div hiding issues In reply to
Hi,

I already have that:

Code:
<div id="title_div" style="display: none;">
<input type="text" name="Title" size="30">
</div>

Doesn't matter now though - as I've got it workin :)

Cheers

Andy (mod)
andy@ultranerds.co.uk


IMPORTANT: I've now moved to ultranerds.co.uk, and the .com will no longer work!
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package (plugins total "value" $3,325 & rising, for just $350)| GLinks ULTRA Package PRO (plugins total "value" $5,625 & rising, for just $500)
Support Forum | Links SQL Plugins | DMOZ Dumps | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Compare our different Plugin packages *new* Free CSS Templates