Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 05-12-2011, 08:00 PM   PM User | #1
kilawen
New to the CF scene

 
Join Date: May 2011
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
kilawen is an unknown quantity at this point
Hide/Show Table plus reset button

Hi,

I need a button that not only resets what is typed in the textarea but also hides all shown tables...

Here's how my current set up is...

---------text area------ with a reset button

table1 title (when clicked, shows a table under it)
table2 title (when clicked, shows a table under it)
table3 title (when clicked, shows a table under it)

the tables under the main tables have buttons that when clicked on inserts texts in the textarea.

Any help would be much much appreciated!
kilawen is offline   Reply With Quote
Old 05-12-2011, 08:04 PM   PM User | #2
DanInMa
Senior Coder

 
DanInMa's Avatar
 
Join Date: Nov 2010
Location: Salem,Ma
Posts: 1,335
Thanks: 13
Thanked 207 Times in 207 Posts
DanInMa is on a distinguished road
show your code!
__________________
- Firebug is a web developers best friend! - Learn it, Love it, use it!
- Validate your code! - JQ/JS troubleshooting
- Using jQuery with Other Libraries - Jslint for Jquery/other JS library users
DanInMa is offline   Reply With Quote
Old 05-12-2011, 08:32 PM   PM User | #3
kilawen
New to the CF scene

 
Join Date: May 2011
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
kilawen is an unknown quantity at this point
im still working on it but here's my draft so far...

(how does one paste codes here.... lemme try this....)

Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
 
<html>
 
<head>
  <title></title>
</head>
 
<body>
<SCRIPT LANGUAGE="JavaScript"> 
// Row Hide function.
// by tcadieux
 
function expandcontract(tbodyid,ClickIcon) {
if (document.getElementById(ClickIcon).innerHTML == "+"){
document.getElementById(tbodyid).style.display = "";
document.getElementById(ClickIcon).innerHTML = "-";
} else {
document.getElementById(tbodyid).style.display = "none";
document.getElementById(ClickIcon).innerHTML = "+";
}}
 
 
 
<!--
var body=0;
linkvar = 0;
function prompt2(String , msg, tags, tags2) {
String=prompt(msg, "");
if (String != "" || null) {document.Form1.none.value=document.Form1.none.value + tags + String + tags2 + '\r'
}
}
 
function end() {
if (body == 0) { addtag('</HTML>') }
else { addtag('</BODY></HTML>') }
}
 
function addtag(tag) {
document.Form1.none.value=document.Form1.none.value + tag + '\r'
}
//-->
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
</SCRIPT>
 
 
 
 
 
 
<FORM name=Form1>
	<table width="500"><td align="right">
		<input type="reset" value="CLEAR NOTES">
	</td>
	</table>
 
 
 
	<TEXTAREA Name=none COLS="60" ROWS="10"></TEXTAREA>
 
 
 
 
 
 
 
 
 
 
<table border=0>
 
	<tr>
		<td onclick="expandcontract('Row1','ClickIcon1')" id="ClickIcon1" style="cursor: pointer; cursor: hand;">+</td>
		<td>table1</td>
	</tr>
 
		<tbody id="Row1" style="display:none">
		<tr>
			<td colspan="2"><INPUT TYPE=button name=none3 value="w1aaat UN/PW" onclick="end('</BODY></HTML>')"></td>
			<td colspan="2"><INPUT TYPE=button name=none3 value="wa2aat UN/PW" onclick="end('</BODY></HTML>')"></td>
		</tr>
		<tr>
 
			<td colspan="2"><INPUT TYPE=button name=none3 value="wat UN/PW" onclick="end('</BODY></HTML>')"></td>	
			<td colspan="2"><INPUT TYPE=button name=none3 value="wa2aat UN/PW" onclick="end('</BODY></HTML>')"></td>
			<td colspan="2"><INPUT TYPE=button name=none3 value="wasda2aat UN/PW" onclick="end('</BODY></HTML>')"></td>
			<td colspan="2"><INPUT TYPE=button name=none3 value="waasdfasf2aat UN/PW" onclick="end('</BODY></HTML>')"></td>
		</tr>
		</tbody>
 
</table>
<p>
 
 
<table border=0>
 
	<tr>
		<td onclick="expandcontract('ARow1','AClickIcon1')" id="AClickIcon1" style="cursor: pointer; cursor: hand;">+</td>
		<td>table2</td>
	</tr>
 
		<tbody id="ARow1" style="display:none">
		<tr>
			<td colspan="2"><INPUT TYPE=button name=none3 value="w1aaat UN/PW" onclick="end('</BODY></HTML>')"></td>
			<td colspan="2"><INPUT TYPE=button name=none3 value="wa2aat UN/PW" onclick="end('</BODY></HTML>')"></td>
		</tr>
		<tr>
 
			<td colspan="2"><INPUT TYPE=button name=none3 value="wat UN/PW" onclick="end('</BODY></HTML>')"></td>	
			<td colspan="2"><INPUT TYPE=button name=none3 value="wa2aat UN/PW" onclick="end('</BODY></HTML>')"></td>
			<td colspan="2"><INPUT TYPE=button name=none3 value="wasda2aat UN/PW" onclick="end('</BODY></HTML>')"></td>
			<td colspan="2"><INPUT TYPE=button name=none3 value="waasdfasf2aat UN/PW" onclick="end('</BODY></HTML>')"></td>
		</tr>
		</tbody>
 
</table>
<p>
<table border=0>
 
	<tr>
		<td onclick="expandcontract('BRow1','BClickIcon1')" id="BClickIcon1" style="cursor: pointer; cursor: hand;">+</td>
		<td>table3</td>
	</tr>
 
		<tbody id="BRow1" style="display:none">
		<tr>
			<td colspan="2"><INPUT TYPE=button name=none3 value="w1aaat UN/PW" onclick="end('</BODY></HTML>')"></td>
			<td colspan="2"><INPUT TYPE=button name=none3 value="wa2aat UN/PW" onclick="end('</BODY></HTML>')"></td>
		</tr>
		<tr>
 
			<td colspan="2"><INPUT TYPE=button name=none3 value="wat UN/PW" onclick="end('</BODY></HTML>')"></td>	
			<td colspan="2"><INPUT TYPE=button name=none3 value="wa2aat UN/PW" onclick="end('</BODY></HTML>')"></td>
			<td colspan="2"><INPUT TYPE=button name=none3 value="wasda2aat UN/PW" onclick="end('</BODY></HTML>')"></td>
			<td colspan="2"><INPUT TYPE=button name=none3 value="waasdfasf2aat UN/PW" onclick="end('</BODY></HTML>')"></td>
		</tr>
		</tbody>
 
</table>
<p>
<table border=0>
 
	<tr>
		<td onclick="expandcontract('CRow1','CClickIcon1')" id="CClickIcon1" style="cursor: pointer; cursor: hand;">+</td>
		<td>table4</td>
	</tr>
 
		<tbody id="CRow1" style="display:none">
		<tr>
			<td colspan="2"><INPUT TYPE=button name=none3 value="w1aaat UN/PW" onclick="end('</BODY></HTML>')"></td>
			<td colspan="2"><INPUT TYPE=button name=none3 value="wa2aat UN/PW" onclick="end('</BODY></HTML>')"></td>
		</tr>
		<tr>
 
			<td colspan="2"><INPUT TYPE=button name=none3 value="wat UN/PW" onclick="end('</BODY></HTML>')"></td>	
			<td colspan="2"><INPUT TYPE=button name=none3 value="wa2aat UN/PW" onclick="end('</BODY></HTML>')"></td>
			<td colspan="2"><INPUT TYPE=button name=none3 value="wasda2aat UN/PW" onclick="end('</BODY></HTML>')"></td>
			<td colspan="2"><INPUT TYPE=button name=none3 value="waasdfasf2aat UN/PW" onclick="end('</BODY></HTML>')"></td>
		</tr>
		</tbody>
 
</table>
 
<p>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
</form>
</body>
 
</html>
kilawen is offline   Reply With Quote
Old 05-12-2011, 08:34 PM   PM User | #4
kilawen
New to the CF scene

 
Join Date: May 2011
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
kilawen is an unknown quantity at this point
that worked. so what i want is when that clear notes button is clicked. it not only resets the textarea but also hides all the tables that i have opened and make it look like when i first open the page.
kilawen is offline   Reply With Quote
Reply

Bookmarks

Tags
hide show table, reset button, table

Jump To Top of Thread


Thread Tools
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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 10:13 AM.


Advertisement
Log in to turn off these ads.