JavaScript Hidding and Showing Layers

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
User avatar
nickman013
Forum Regular
Posts: 764
Joined: Sun Aug 14, 2005 12:02 am
Location: Long Island, New York

JavaScript Hidding and Showing Layers

Post by nickman013 »

Hello, I have a current JS that works, but I need one thing solved.

This is the script:

Code: Select all

<?
$page = "previous muots.";
include('/home/muot/public_html/pages/includes/regpage.php');
?>
<script  type="text/javascript">
function alterDisplayProperties(linkName, divName){
	
	if (document.getElementById(divName).style.display == "none"){
		document.getElementById(divName).style.display = "BLOCK";
		document.getElementById(linkName).innerHTML = 'Hide description';
	}else{
		document.getElementById(divName).style.display = "none";
		document.getElementById(linkName).innerHTML = 'View More';
	}
}
</script>
		<div>
			<span>Muot Week #2 - Chatter Box &nbsp;&nbsp;<a href="#" id = 'link14' onclick="alterDisplayProperties('link14', 'div14')">View This Muot</a></span>                    
			<div id ="div14" style="clear:both;">
				<table border=1 align=center width=350>

<tr><th colspan=2><div align=left style=display:inline;>Muot Week # 2</div>--<div align=right style=display:inline;> 1.22.04 </div></th></tr>

<tr><th colspan=2><img src=/pages/muotreport/chatter.bmp></tr></td>

<tr><td width=50 valign=top><div align=center>Bio:</div><br>

<div align=left>Name:</div>&nbsp;&nbsp;&nbsp;<font color=red>umm chad somethign i think</font></div><br>

<div align=left>Nickname:</div>&nbsp;&nbsp;&nbsp;&nbsp;<font color=red>chatterbox</font></div><br>

<div align=left>Age:</div>&nbsp;&nbsp;&nbsp;&nbsp;<font color=red>20</font></div><br>

<div align=left>Loc:</div>&nbsp;&nbsp;&nbsp;&nbsp;<font color=red>Oneonta, N.Y.</font></div><br>

<div align=left>Sex:</div>&nbsp;&nbsp;&nbsp;&nbsp;<font color=red>MALE</font></div><br>

<div align=left>Weight:</div>&nbsp;&nbsp;&nbsp;&nbsp;<font color=red>160</font></div><br>

<div align=left>Height:</div>&nbsp;&nbsp;&nbsp;&nbsp;<font color=red>5' 4"</font></div></td>

<td valign=top width=50><div align=left>Muot Status:</div>&nbsp;&nbsp;&nbsp;&nbsp;<font color=red>kids a serious muot</font></div><br><div align=left>About this Muot:</div>&nbsp;&nbsp;&nbsp;&nbsp;<font color=red>This muotomeyer was found in upstate ny in a college town of oneonta. This idiot is in a frat and acts tough but was obviously the loser in his highscool. Known for talking to girls about him having sex with other girls...real muot. And also three strikes against this muot for looking like brandon.</font></td></tr>

</table>
			</div>
	  </div>
	  	<div>
			<span>Muot Week #1 - James       
			&nbsp;&nbsp;<a href="#" id = 'link2' onclick="alterDisplayProperties('link2', 'div2')">View More</a></span>                     
			<div id="div2">
				<table border=1 align=center width=350>

<tr><th colspan=2><div align=left style=display:inline;>Muot Week # 1</div><div align=right style=display:inline;>-- 1.14.06 </div></th></tr>

<tr><th colspan=2><img src=/pages/muotreport/james.jpg width=320 height=240></tr></td>

<tr><td width=50><div align=center>Bio:</div><br>

<div align=left>Name:</div>&nbsp;&nbsp;&nbsp;<font color=red>James Dubanos</font></div><br>

<div align=left>Nickname:</div>&nbsp;&nbsp;&nbsp;&nbsp;<font color=red>Street Pharmacist</font></div><br>

<div align=left>Age:</div>&nbsp;&nbsp;&nbsp;&nbsp;<font color=red>16</font></div><br>

<div align=left>Loc:</div>&nbsp;&nbsp;&nbsp;&nbsp;<font color=red>North Babylon, NY</font></div><br>

<div align=left>Sex:</div>&nbsp;&nbsp;&nbsp;&nbsp;<font color=red>MALE</font></div><br>

<div align=left>Weight:</div>&nbsp;&nbsp;&nbsp;&nbsp;<font color=red>Skinny Rat</font></div><br>

<div align=left>Height:</div>&nbsp;&nbsp;&nbsp;&nbsp;<font color=red>5 foot 8 inches</font></div></td>

<td valign=top width=50><div align=left>Muot Status:</div>&nbsp;&nbsp;&nbsp;&nbsp;<font color=red>This muot is currently running around in you local sewer system.</font></div><br><div align=left>About this Muot:</div>&nbsp;&nbsp;&nbsp;&nbsp;<font color=red>This muot is not like all muots. This Muot is half muot, half rat!</b></font></td></tr>

</table>
			</div>
		</div>
		<div>
When displayed on the page, it views, what is supposed to be the hidden data. I would like the page to start off so the data is hidden.

Thank You!
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

set the style for each element to be hidden to display:none :?
User avatar
nickman013
Forum Regular
Posts: 764
Joined: Sun Aug 14, 2005 12:02 am
Location: Long Island, New York

Post by nickman013 »

Thanks alot feyd, it works perfect.
Post Reply