Today's Posts Follow Us On Twitter! TFL Members on Twitter  
Forum search: Advanced Search  
Navigation
Marketplace
  Members Login:
Lost password?
  Forum Statistics:
Forum Members: 24,254
Total Threads: 80,792
Total Posts: 566,472
There are 1625 users currently browsing (tf).
 
  Our Partners:
 
  TalkFreelance     Design and Development     Programming     PHP and MySQL :

show hide in javascriipt

Thread title: show hide in javascriipt
Closed Thread  
Page 1 of 2 1 2 >
    Thread tools Search this thread Display Modes  
11-07-2006, 07:48 PM
#1
evan2all is offline evan2all
evan2all's Avatar
Status: Junior Member
Join date: Oct 2006
Location: Bangladesh
Expertise:
Software:
 
Posts: 39
iTrader: 0 / 0%
 

evan2all is on a distinguished road

  Old  show hide in javascriipt

Hello


can any one give me some links of of tutorials where i can find out the show and hide funcyionalities thats been used in yahoo.......(not exacly yahoo)


lets thikn a login button...after click on it user will see a username and password form and a submit button under it......without redirecting to a page.....


please need some help...
Thanks

11-07-2006, 08:08 PM
#2
Awesome is offline Awesome
Awesome's Avatar
Status: Pastafarian
Join date: May 2006
Location: Duct Taped to your Ceiling
Expertise:
Software:
 
Posts: 3,440
iTrader: 26 / 93%
 

Awesome is on a distinguished road

  Old

11-07-2006, 08:16 PM
#3
evan2all is offline evan2all
evan2all's Avatar
Status: Junior Member
Join date: Oct 2006
Location: Bangladesh
Expertise:
Software:
 
Posts: 39
iTrader: 0 / 0%
 

evan2all is on a distinguished road

  Old

neep more specified tutorials.......

11-07-2006, 08:24 PM
#4
Tom is offline Tom
Tom's Avatar
Status: I Code Things
Join date: Aug 2005
Location: UK
Expertise:
Software:
 
Posts: 1,998
iTrader: 14 / 100%
 

Tom is on a distinguished road

Send a message via MSN to Tom

  Old

umm, i think northpark as used something like this on his site maybe ask him.

11-07-2006, 09:28 PM
#5
northpark is offline northpark
northpark's Avatar
Status: I'm Spamming
Join date: Sep 2005
Location: Americawww
Expertise:
Software:
 
Posts: 3,963
iTrader: 0 / 0%
 

northpark is on a distinguished road

Send a message via MSN to northpark

  Old

Originally Posted by White Line
umm, i think northpark as used something like this on his site maybe ask him.
Why ask, I am already here?

this site pretty much taught me how to do it:
http://www.dustindiaz.com/dhtml-expa...apse-div-menu/

11-07-2006, 10:14 PM
#6
Salathe is offline Salathe
Salathe's Avatar
Status: Community Archaeologist
Join date: Jul 2004
Location: Scotland
Expertise: Software Development
Software: vim, PHP
 
Posts: 3,820
iTrader: 25 / 100%
 

Salathe will become famous soon enough

Send a message via MSN to Salathe

  Old

It all comes down to manipulating CSS properties through javascript, namely the element.style.display property.

11-08-2006, 04:54 AM
#7
derek lapp is offline derek lapp
Status: design rockstar
Join date: Jan 2005
Location: guelph, ontario
Expertise:
Software:
 
Posts: 2,246
iTrader: 0 / 0%
 

derek lapp is on a distinguished road

  Old

Code:
function show_fieldset(id, int) {
	if(int == 1) {
		document.getElementById(id).style.display = 'block';
	} else {
		document.getElementById(id).style.display = 'none';
	}
}
HTML Code:
<a href="#" onclick="show_fieldset('frm_login', 1)">Show Login Form</a>
<form id="frm_login" action="login.php" method="post" style="display: none;">
	{FIELDS}
</form>

11-08-2006, 09:19 AM
#8
t0m is offline t0m
Status: Request a custom title
Join date: Jan 2005
Location: West Sussex, England
Expertise:
Software:
 
Posts: 2,829
iTrader: 21 / 100%
 

t0m is on a distinguished road

  Old

Can this be used to simply show/hide an image? In a div/table row...

11-08-2006, 12:16 PM
#9
northpark is offline northpark
northpark's Avatar
Status: I'm Spamming
Join date: Sep 2005
Location: Americawww
Expertise:
Software:
 
Posts: 3,963
iTrader: 0 / 0%
 

northpark is on a distinguished road

Send a message via MSN to northpark

  Old

Originally Posted by stillt
Can this be used to simply show/hide an image? In a div/table row...
yeah, but a link must be provided; you can just click an image and have it disappear, because you wouldn't be able to make it come back ;p

11-08-2006, 03:08 PM
#10
derek lapp is offline derek lapp
Status: design rockstar
Join date: Jan 2005
Location: guelph, ontario
Expertise:
Software:
 
Posts: 2,246
iTrader: 0 / 0%
 

derek lapp is on a distinguished road

  Old

yes it can, but that function is ideal for when you have seperate links, like 'yes / no', 'show / hide', etc, where you can change the int -> yes would be 1, no would be 0.

if you want the function to show or hide with the same link - IE you have a name and on click you want to show or hide its details, you'd use something like this:

Code:
function show_fieldset(id) {
	// if style.display is set to something other than block
	if(document.getElementById(id).style.display != 'block') {
		// set it to block
		document.getElementById(id).style.display = 'block';
	} else {
		// otherwise, set it to none
		document.getElementById(id).style.display = 'none';
	}
}
in these i've applied the style"" attribute right on the element in the html because it was for showing / hiding a fieldset, so a class in the css file was no more effecient.

if you're going to use it on a lot of elements you'd use document.getElementById(id).className and your class name instead of document.getElementById(id).style.display.

Closed Thread  
Page 1 of 2 1 2 >


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 

  Posting Rules  
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump:
 
  Contains New Posts Forum Contains New Posts   Contains No New Posts Forum Contains No New Posts   A Closed Forum Forum is Closed