toggling problem

Discussion in 'JavaScript' started by gilgalbiblewheel, Nov 22, 2007.

  1. #1
    I'm trying to toggle a form. What's wrong with this?
    	<script type="text/javascript" language="javascript1.3">
    			function toggle(id){
    				ol = "ol_" + id;
    				img = "img_" + id;
    				olElement = document.getElementById(ol);
    				imgElement = document.getElementById(img);
    				if (olElement){
    						if (olElement.className == 'closed'){
    								olElement.className = "open";
    								imgElement.src = "images/opened.gif";
    								}else{
    								olElement.className = "closed";
    								imgElement.src = "images/closed.gif";
    								}
    						}
    				}
    		</script>
    		<a  onclick="toggle('item1');">	
    			<h5><img src="images/closed.gif" alt="Click to Expand" id="img_item1" border="0" /> Email it to Someone</h5></a>
    			<ol type="none" id="ol_item1" class="closed">
    				<li id="item1_1">
    					<form name="mailing" method="post" action="article.asp?id=1447#send" enctype="application/x-www-form-urlencoded">
    					  <input name="send" type="hidden" value="1" />
    					  <div id="div10a">SEND THIS WEBSITE TO A FRIEND:</div>
    					  <div id="div10b">From:&nbsp;</div>
    					  <div id="div10c">
    						<input type="text" name="name" size="20" value="[your e-mail address]" class="form-input" onblur="if(this.value==''){this.value='[your e-mail address]';}" onfocus="if(this.value=='[your e-mail address]'){this.value='';}" />
    	
    						</div>
    						<div id="div10d">
    	
    							<input name="submit" type="submit" title="Send it" value=" Send " size="100" />
    							<input name="reset" type="reset" value="Reset" />
    						</div>
    						<div id="div10e">To:&nbsp;</div>
    						<div id="div10f">
    							<input type="text" name="name" size="20" value="[recipient e-mail address]" class="form-input" onblur="if(this.value==''){this.value='[recipient e-mail address]';}" onfocus="if(this.value=='[recipient e-mail address]'){this.value='';}" />
    						  </div>
    					</form>
    				</li>
    			</ol> 
    Code (markup):

     
    gilgalbiblewheel, Nov 22, 2007 IP
  2. WL_Marketing

    WL_Marketing Banned

    Messages:
    216
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Try adding href="#" in the anchor tag.
     
    WL_Marketing, Nov 27, 2007 IP