JavaScript Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsWeb DesignJavaScript Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old December 13th, 2004, 12:05 PM
gamegeezer gamegeezer is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2004
Posts: 28 gamegeezer User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Unhappy Display/Hide Div

Hello All,

I'm running into a little trouble trying to display a hidden div... I could swear that I had done this exact same thing before and it worked fine...

Quote:
function DisplayNav(in_strName, in_obj)
{
if (strCurrentDisplay != in_strName)
{
strCurrentDisplay = in_strName;

document.getElementById('Practice').style.display='none';
document.getElementById('Tournaments').style.display='none';
document.getElementById('Archive').style.display='none';
document.getElementById('Photos').style.display='none';

document.getElementById(in_strName).style.display='';
}
}

Hiddend Div
Quote:
<div id="Photos" style="DISPLAY: none">
<table border="0" width="800" cellspacing="0" cellpadding="0">
<tr>
<td width="100%">
<table border="0" width="100%" cellspacing="0" cellpadding="3">
<tr>
<td width="100%"><p align="center"><b><font face="Arial" size="5">Team Photos</font></b></td>
</tr>
<tr>
<td width="100%">soon...</span></td>
</tr>
</table>
</td>
</tr>
</table>
<hr noshade size="5" width="800" align="left">
</div>

The link to display the Div (and hide others)
Quote:
<A href="javascript:DisplayNav('Photos')">Practice Schedule</A>


The error I get is...

error object expected.

Any help is much appreciated.

~Thanks, Jim

Reply With Quote
  #2  
Old December 13th, 2004, 12:10 PM
ChiefWigs1982's Avatar
ChiefWigs1982 ChiefWigs1982 is offline
Cunning Linguist
Dev Shed God 11th Plane (10000 - 10499 posts)
 
Join Date: Jul 2003
Location: I used to live at home, now I stay at the house
Posts: 10,180 ChiefWigs1982 User rank is General 16th Grade (Above 100000 Reputation Level)ChiefWigs1982 User rank is General 16th Grade (Above 100000 Reputation Level)ChiefWigs1982 User rank is General 16th Grade (Above 100000 Reputation Level)ChiefWigs1982 User rank is General 16th Grade (Above 100000 Reputation Level)ChiefWigs1982 User rank is General 16th Grade (Above 100000 Reputation Level)ChiefWigs1982 User rank is General 16th Grade (Above 100000 Reputation Level)ChiefWigs1982 User rank is General 16th Grade (Above 100000 Reputation Level)ChiefWigs1982 User rank is General 16th Grade (Above 100000 Reputation Level)ChiefWigs1982 User rank is General 16th Grade (Above 100000 Reputation Level)ChiefWigs1982 User rank is General 16th Grade (Above 100000 Reputation Level)ChiefWigs1982 User rank is General 16th Grade (Above 100000 Reputation Level)ChiefWigs1982 User rank is General 16th Grade (Above 100000 Reputation Level)ChiefWigs1982 User rank is General 16th Grade (Above 100000 Reputation Level)ChiefWigs1982 User rank is General 16th Grade (Above 100000 Reputation Level)ChiefWigs1982 User rank is General 16th Grade (Above 100000 Reputation Level)ChiefWigs1982 User rank is General 16th Grade (Above 100000 Reputation Level)  Folding Points: 50746 Folding Title: Beginner FolderFolding Points: 50746 Folding Title: Beginner FolderFolding Points: 50746 Folding Title: Beginner Folder
Time spent in forums: 3 Months 3 Weeks 5 Days 19 h 54 m 23 sec
Reputation Power: 2037
First of all, this...
Code:
 document.getElementById(in_strName).style.display='';

...should be like this...
Code:
 document.getElementById(in_strName).style.display='block';

Secondly, what is giving the error? What does the FireFox js debugger tell you? Or if you are using IE, where in the code is the error?
__________________
Support requests via PM will be ignored!
Sites: WordPress Metro Theme | Route of Queue
Read These: The General Rules Thread | The General FAQ Thread | NEW USERS - How to post a question


Reply With Quote
  #3  
Old December 13th, 2004, 12:21 PM
gamegeezer gamegeezer is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2004
Posts: 28 gamegeezer User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Hey ChiefWigs1982,

I'm using IE, and I get the error on the HREF...

Code:
DisplayNav('Practice')


Your help is much appreciated.

~Thanks again, Jim

Reply With Quote
  #4  
Old December 13th, 2004, 12:29 PM
ChiefWigs1982's Avatar
ChiefWigs1982 ChiefWigs1982 is offline
Cunning Linguist
Dev Shed God 11th Plane (10000 - 10499 posts)
 
Join Date: Jul 2003
Location: I used to live at home, now I stay at the house
Posts: 10,180 ChiefWigs1982 User rank is General 16th Grade (Above 100000 Reputation Level)ChiefWigs1982 User rank is General 16th Grade (Above 100000 Reputation Level)ChiefWigs1982 User rank is General 16th Grade (Above 100000 Reputation Level)ChiefWigs1982 User rank is General 16th Grade (Above 100000 Reputation Level)ChiefWigs1982 User rank is General 16th Grade (Above 100000 Reputation Level)ChiefWigs1982 User rank is General 16th Grade (Above 100000 Reputation Level)ChiefWigs1982 User rank is General 16th Grade (Above 100000 Reputation Level)ChiefWigs1982 User rank is General 16th Grade (Above 100000 Reputation Level)ChiefWigs1982 User rank is General 16th Grade (Above 100000 Reputation Level)ChiefWigs1982 User rank is General 16th Grade (Above 100000 Reputation Level)ChiefWigs1982 User rank is General 16th Grade (Above 100000 Reputation Level)ChiefWigs1982 User rank is General 16th Grade (Above 100000 Reputation Level)ChiefWigs1982 User rank is General 16th Grade (Above 100000 Reputation Level)ChiefWigs1982 User rank is General 16th Grade (Above 100000 Reputation Level)ChiefWigs1982 User rank is General 16th Grade (Above 100000 Reputation Level)ChiefWigs1982 User rank is General 16th Grade (Above 100000 Reputation Level)  Folding Points: 50746 Folding Title: Beginner FolderFolding Points: 50746 Folding Title: Beginner FolderFolding Points: 50746 Folding Title: Beginner Folder
Time spent in forums: 3 Months 3 Weeks 5 Days 19 h 54 m 23 sec
Reputation Power: 2037
I can't see anything wrong with your href... Do you have a link to your code?

Object expected is usually IE's way of telling you it can't find the function you are looking for. JS is ub0r case-sensitive, so make sure the function name is the same as the one you are calling...

Reply With Quote
  #5  
Old December 13th, 2004, 01:19 PM
gamegeezer gamegeezer is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2004
Posts: 28 gamegeezer User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Here is the code...

code

I appreciate you taking a look. It has me stumped.

~Thanks, Jim

Reply With Quote
  #6  
Old December 13th, 2004, 01:35 PM
ChiefWigs1982's Avatar
ChiefWigs1982 ChiefWigs1982 is offline
Cunning Linguist
Dev Shed God 11th Plane (10000 - 10499 posts)
 
Join Date: Jul 2003
Location: I used to live at home, now I stay at the house
Posts: 10,180 ChiefWigs1982 User rank is General 16th Grade (Above 100000 Reputation Level)ChiefWigs1982 User rank is General 16th Grade (Above 100000 Reputation Level)ChiefWigs1982 User rank is General 16th Grade (Above 100000 Reputation Level)ChiefWigs1982 User rank is General 16th Grade (Above 100000 Reputation Level)ChiefWigs1982 User rank is General 16th Grade (Above 100000 Reputation Level)ChiefWigs1982 User rank is General 16th Grade (Above 100000 Reputation Level)ChiefWigs1982 User rank is General 16th Grade (Above 100000 Reputation Level)ChiefWigs1982 User rank is General 16th Grade (Above 100000 Reputation Level)ChiefWigs1982 User rank is General 16th Grade (Above 100000 Reputation Level)ChiefWigs1982 User rank is General 16th Grade (Above 100000 Reputation Level)ChiefWigs1982 User rank is General 16th Grade (Above 100000 Reputation Level)ChiefWigs1982 User rank is General 16th Grade (Above 100000 Reputation Level)ChiefWigs1982 User rank is General 16th Grade (Above 100000 Reputation Level)ChiefWigs1982 User rank is General 16th Grade (Above 100000 Reputation Level)ChiefWigs1982 User rank is General 16th Grade (Above 100000 Reputation Level)ChiefWigs1982 User rank is General 16th Grade (Above 100000 Reputation Level)  Folding Points: 50746 Folding Title: Beginner FolderFolding Points: 50746 Folding Title: Beginner FolderFolding Points: 50746 Folding Title: Beginner Folder
Time spent in forums: 3 Months 3 Weeks 5 Days 19 h 54 m 23 sec
Reputation Power: 2037
Why are you using this script tag?
Code:
<script language="JavaScript" for="window" event="onload">

Change your whole script block to this...
Code:
<script language="JavaScript">
var strCurrentDisplay='';
function DisplayDIV(in_strName)
{
	document.getElementById('Practice').style.display='none';
	document.getElementById('Tournaments').style.display='none';
	document.getElementById('Archive').style.display='none';
	document.getElementById('Photos').style.display='none';
	document.getElementById(in_strName).style.display='block';
}
</script>

Reply With Quote
  #7  
Old December 13th, 2004, 01:48 PM
gamegeezer gamegeezer is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2004
Posts: 28 gamegeezer User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Thanks ChiefWigs1982, that worked like a charm! Your help is much appreciated.

~Jim

Reply With Quote
Reply

Viewing: Dev Shed ForumsWeb DesignJavaScript Development > Display/Hide Div

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap