www.webdeveloper.com
Results 1 to 3 of 3

Thread: two simple questions

  1. #1
    Join Date
    Apr 2010
    Posts
    9

    two simple questions

    1. I want to make form with 2 select filds that one of them will be disabled if in the first the use choose a specific option
    i wrote it in this way (but its not work)
    how I fix it?

    Code:
    <script type="text/javascript">
    
    
    function itay() {
    if (document.some1.one.value="x")
    	document.some1.two.disabled=true
    if (document.some1.one.value="y")
    	document.some1.two.disabled=false
    }
    
    </script> 
    
    </head>
    <body bgcolor="#FFFFFF">
    <form name="some1">
    <table>
    	<tr>
    
    		<td> <select id="one" onclick="itay()">
      			 <option value="x">x</option>
     			 <option value="y">y</option>
    		        </select>
                    </td>
    		<td> <select id="two">
      			 <option value="a">a</option>
     			 <option value="b">b</option>
    		        </select>
                    </td>
    	
    	</tr>
    </table>
    </form>
    2. I want that after u fill the form and press submit u will see a txtarea with all the options u selected (for confirm that you chose the right things) and then press submit agien and get all the things u saw in the txtarea to a Email.
    (Hope u understand )
    so how I do it?

  2. #2
    Join Date
    Mar 2010
    Posts
    2,803
    This is the first part.

    I have to go soon so not enough time to do the rest
    PHP Code:
     
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
    >
    <
    html xmlns="http://www.w3.org/1999/xhtml">
    <
    head>
    <
    title></title>
    <
    style type="text/css">
    <!--

    #div1 {
    floatleft}
     
    -->
    </
    style>

    <
    script type="text/javascript">
    <!--
     
    function 
    chkSel1(val) {
       if(
    val == "x") {
           
    document.getElementById("sel2").disabled true;
       } else {
           
    document.getElementById("sel2").disabled false;
       }
    }
     
    //-->
    </script>

    </head>
    <body>
     
    <div id="div1">
        <select id="sel1" onchange="chkSel1(this.value);">
                 <option value="s">Select a value</option>
          <option value="x">x</option>
         <option value="y">y</option>
       </select>
    </div>

    <div>
        <select id="sel2" >
          <option value="a">a</option>
         <option value="b">b</option>
       </select>
    </div>
     
    </body>
    </html> 

  3. #3
    Join Date
    Apr 2010
    Posts
    9
    works great ty, hope u will post the rest when u will back :]

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles