Free JavaSccript codes

Simple JavaScript Code for Layer Display Toggle

One more JavaScript code example to show/hide a layer every time the users click the specified text link. In live demo of this JavaScript code example, the script used to toggle the comments in a post... detail at - 2.000+ free JavaScript codes

How to setup

Step 1: Copy & Paste CSS code below in your HEAD section
<style type="text/css">
     This script downloaded from
     Come to view and download over 2000+ free javascript at

	margin-left: 25%;
	padding: 10px;
	background-color: #FFCF31;
	border: 1px solid #00009C;
	width: 450px;
	text-align: left;

div.quote p {
	font-size: .8em;
	margin: 0px 0px 0px 0px;

div#commentForm {
	display: none;
	margin: 0px 20px 0px 20px;
	font-family: Arial, sans-serif;
	font-size: .8em;

a.commentLink {
 	font-family: Arial, sans-serif;
	 font-size: .9em;
Step 2: Use JavaScript code below to setup the script
<script type="text/javascript">
// Created by: Justin Barlow |
// This script downloaded from

function toggleLayer(whichLayer) {
  var elem, vis;
  if(document.getElementById) // this is the way the standards work
    elem = document.getElementById(whichLayer);
  else if(document.all) // this is the way old msie versions work
      elem = document.all[whichLayer];
  else if(document.layers) // this is the way nn4 works
    elem = document.layers[whichLayer];
  vis =;
  // if the style.display value is blank we try to figure it out here
    vis.display = (elem.offsetWidth!=0&&elem.offsetHeight!=0)?'block':'none';
  vis.display = (vis.display==''||vis.display=='block')?'none':'block';
Step 3: Copy & Paste HTML code below in your BODY section
     This script downloaded from
     Come to view and download over 2000+ free javascript at
<div class="quote">

<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Praesent porttitor luctus quam. Pellentesque diam libero, feugiat quis, porttitor sagittis, suscipit dignissim, pede. Duis dapibus mauris at enim. Morbi vehicula turpis nec massa.</p>
<p style="text-align: right;"><a class="commentLink" title="Add a comment to this entry" href="javascript:toggleLayer('commentForm');">Add a comment</a>

<div id="commentForm">
<form id="addComment" action="" method="get">
	 <input name="name"><br>
	 <textarea rows="3" cols="40" name="comment"></textarea><br>

	 <input name="submit" value="Add Comment" type="submit"> <input onclick="javascript:toggleLayer('commentForm');" name="reset" value="Cancel" type="reset"></p>


Command to print web page in javascript - Javascript Time Picker - JavaScript Go To URL Box
Quote Originally Posted by Copyright
The Site may provide, or third parties may provide, links to Internet World Wide Web sites or resources. Because has no control over such sites and resources, you acknowledge and agree that is not responsible for the availability of such external sites or resources, and does not endorse and is not responsible or liable for any content, advertising, products, or other materials on or available from such sites or resources. You further acknowledge and agree that shall not be responsible or liable, directly or indirectly, for any damage or loss caused or alleged to be caused by or in connection with use of or reliance on any such content, goods or services available on or through any such site or resource.