Results 1 to 3 of 3

Thread: js doesnt work in firefox but does in IE?

  1. #1
    Join Date
    May 2009
    Posts
    15
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default js doesnt work in firefox but does in IE?

    hey guys, just trying to make a simple script that when you check a checkbox it shows a <div> i created. There is some customization: it only shows the div if you go from an unchecked to a checked state, and if you hit a "cancel" button it unchecks the box again. Works perfectly in IE, but the <div> doesn't get shown at all in firefox...???

    Code:
    <script type=text/javascript>
    <!--
    function showMe(id, chkbox) 
    {
    	var obj2 = document.getElementById(chkbox);
    	if (obj2.checked == true)
    	{
    		var obj = document.getElementById(id);
    		if (obj.style.visibility=="hidden") 
    		{
    			obj.style.visibility = "visible";
    		} 
    		else 
    		{
    			obj.style.visibility = "hidden";
    		}
    	}
    }
    
    function submitMe(id) 
    {
    	var obj = document.getElementById(id);
    	obj.style.visibility = "hidden";
    }
    
    function cancelMe(id,chkbox) 
    {
    	var obj = document.getElementById(id);
    	obj.style.visibility = "hidden";
    
    	var obj2 = document.getElementById(chkbox);
    	obj2.checked = false;
    }
    
    //-->
    </SCRIPT>
    
    <div id="my_div" style="position:absolute; z-index: 1; top: 0%; left: 50%; visibility: hidden; width: 450px; height: 200px; border:1px solid #3F3F3F; background-color: #fffecd;">
    <font face=verdana size=3><center> LOGIN INFORMATION </center></font>
    <br><br><br>
    	<table width=50% align=center>
    	<tr>
    		<td width=40%>
    			<font face=verdana size=1>username:</font>
    
    		</td>
    		<td width=60%>
    			<input type="text" name="username" size="50" style="font-family:Verdana; font-size:11; border-width:1; border-color: #000000; border-style:solid;">
    		</td>
    	</tr>
    	<tr>
    		<td width=40%>
    			<font face=verdana size=1>password:</font>
    
    		</td>
    		<td width=60%>
    			<input type="password" name="password" size="50" style="font-family:Verdana; font-size:11; border-width:1; border-color: #000000; border-style:solid;">
    		</td>
    	</tr>
    	</table>
    <br><br>
    <center><input type="image" src="http://www.tech-area.com/files/submit.jpg" onclick="submitMe('my_div');" border=0><font color=#fffecd>.......</font><input type="image" src="http://www.tech-area.com/files/cancel.jpg" onclick="cancelMe('my_div', 'mybox');" border=0>
    </div>
    
    
    
    <form name="myform">
    <center><input type="checkbox" name="mybox" onclick="showMe('my_div', 'mybox');" value="Show Active">Show Hide Checkbox
    </form>
    Last edited by Snookerman; 05-20-2009 at 04:32 PM. Reason: added “Resolved” prefix

  2. #2
    Join Date
    Dec 2008
    Location
    Portsmouth, UK
    Posts
    1,800
    Thanks
    2
    Thanked 421 Times in 415 Posts

    Default

    Code:
    <form name="myform">
    <center><input type="checkbox" id="myspacebox"  name="myspacebox" onclick="showMe('myspace_div', 'myspacebox');" value="Show Active">Show Hide Checkbox
    </form>

  3. #3
    Join Date
    May 2009
    Posts
    15
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    oh my god i knew it was something dumb i'd done. thank you !

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •