SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Wizard Defender1's Avatar
    Join Date
    Apr 2001
    Location
    My Computer
    Posts
    2,808
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Disable a field on a checkbox click

    I'm trying to use the javascript posted here:
    http://www.sitepointforums.com/showt...=disable+field

    Well, it's not working.
    I get no errors. It just does nothing.

    here's my source:
    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <title>
    Webinfractions.com
    </title>
    <link rel="stylesheet" href="/webinfra.css" type="text/css">
    <script language="javascript1.2">
    <!--
    	function disable_enable()
    	{
    		//if the surfer is using IE 4 or above
    		if (document.all)
    		{
    			if (document.test1.test2.disabled==true)
    			{
    				document.test1.test2.disabled=false
    			}
    			else
    			{
    				document.test1.test2.disabled=true
    			}
    		}
    	}
    	function changeState(formElement,bool)
    	{
    		dom="document.bob."
    		dis=".disabled="
    		eval(dom+formElement+dis+bool)
    	}
    -->
    </script>
    </head>
    <body class="margins" background="/images/bg_img.jpg" link="#FFCC66" vlink="#FFE3B8" alink="#99B1CA">
    	<form action="/admin/desktop_sizes.php" method="post" name="test1">
    	<table width="475" cellpadding="1" cellspacing="1" align="center">
    	 <tr>
    	  <td width="100%" valign="middle"><span class="body11">Use this form to insert desktop resolutions into the database.</span></td>
    	 </tr>
    	 <tr>
    	  <td width="100%"><hr><span class="header2">Desktop Info</span><hr></td>
    	 <tr>
    	  <td width="100%"><span class="body5">Desktop Id:</span>  <input type="text" name="tutor_id" size="1" maxlength="2" value="5"></td>
    	 </tr>
    	 <tr>
    	  <td width="100%"><hr><span class="header2">Resolution Info</span><hr></td>
    	 <tr>
    	 <tr>
    	  <td width="100%"><input type="checkbox" name="check1" value="1" onclick="disable_enable()"><span class="body5">640x480<br /><input type="text" id="test2" name="step_image" size="32"></td>
    	 </tr>
    	 <tr>
    	  <td width="100%" align="left"><input type="hidden" name="submitted" value="sent"><input type="submit" name="go" value="Enter Step"><input type="reset" name="reset" value="Clear Form">
    	</table>
    	</form>
            </body>
            </html>
    Though I will need that to work for 4 text fields.
    Defender's Designs
    I'm Getting Married!

    Not-so-patiently awaiting Harry Potter Book 7 *sigh*

  2. #2
    SitePoint Wizard Defender1's Avatar
    Join Date
    Apr 2001
    Location
    My Computer
    Posts
    2,808
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Nevermind, it seems to be working.
    Defender's Designs
    I'm Getting Married!

    Not-so-patiently awaiting Harry Potter Book 7 *sigh*


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
  •