GIDForums  

Go Back   GIDForums > Computer Programming Forums > MySQL / PHP Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 23-Jan-2007, 04:05
ctrohaya ctrohaya is offline
New Member
 
Join Date: Nov 2006
Posts: 29
ctrohaya is on a distinguished road

hide textarea....


how to hide textarea when clicking button and show again that textarea when re-click same button....
  #2  
Old 30-Jan-2007, 08:16
meurer meurer is offline
New Member
 
Join Date: Jan 2007
Posts: 2
meurer is on a distinguished road

Re: hide textarea....


Seems more of a JavaScript question than a MySQL/PHP question. The following will do what you want to do in javascript:

HTML Code:
<html> <head> <script language="JavaScript" type="text/javascript"> function showhide(spanname) { <!-- This function shows/hides a span when its button is clicked. --> <!-- It changes the css display property. --> if (document.getElementById(spanname).style.display=="") { document.getElementById(spanname).style.display="none"; <!-- for some reason, this forum post system keeps adding a space in the "none" value here. Make sure to take this space out before you use it! --> } else if (document.getElementById(spanname).style.display=="none"){ document.getElementById(spanname).style.display=""; } } </script> </head> <body> <span id="txtArea1"> <textarea rows="10" cols="20"> Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Morbi faucibus. Aenean lectus orci, euismod a, auctor a, porta non, dui. </textarea> </span> <br/> <button onClick="javascript: showhide('txtArea1');">Click Me!</button> </body> </html>

==================================
  1. Put the showhide function in the head
  2. Wrap your textarea with a span tag
  3. "id" the span tag
  4. Insert the onClick attribute on the submit button with the JavaScript call (make sure to change the parameter!)
Last edited by admin II : 01-Feb-2007 at 08:48. Reason: Please surround HTML code with [html] ... [/html]
  #3  
Old 30-Jan-2007, 21:01
ctrohaya ctrohaya is offline
New Member
 
Join Date: Nov 2006
Posts: 29
ctrohaya is on a distinguished road

Re: hide textarea....


i'm using a loop. then, there are more than one textarea shown with the same id. i've test the given script. it does work and i'm happy but only first textarea work when i clicked the button. i expect all textarea will be hidden once button is clicked.....
 
 

Recent GIDBlogProgramming ebook direct download available by crystalattice

Thread Tools Search this Thread
Search this Thread:

Advanced Search
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 Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
limiting characters in textarea without php/javascript mrjameer MySQL / PHP Forum 1 04-Oct-2006 21:59
mixed font face in html textarea praveen0701 Web Design Forum 2 31-Jul-2006 15:19
[Tutorial] How to hide e-mail address from SPAM Bots BobbyDouglas Web Design Forum 40 13-Feb-2006 10:44
How to hide characters from being displayed on screen as they are keyed in? nkhambal C++ Forum 8 10-Aug-2004 10:22
textarea width problem zuzupus Web Design Forum 2 23-Jul-2003 04:06

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 13:25.


vBulletin, Copyright © 2000 - 2009, Jelsoft Enterprises Ltd.