36 users online (1 members and 35 guests)  


  Results 1 to 7 of 7

Related

  1. form input changes textarea output    Forum: Javascript Forum
    Replies: 1
  2. Swap textarea values    Forum: Javascript Forum
    Replies: 1
  3. trying to write to textarea based on user input    Forum: Javascript Forum
    Replies: 5
  4. Replies: 1
  5. Replies: 4
  1. #1
    razka3's Avatar
    New User

    Status
    Offline
    Join Date
    Sep 2008
    Posts
    10

    Question using javascript to update checkbox values and write output to textarea dynamically

    Hello all,

    I ended up having to work on this test page for my job, it's a little in house verification page being run on an embedded board with it's own HTTP server. Values on the server are parsed using tokens and passed to the javascript arrays, which are then used to populate the fields on the html page. Only I'm having trouble displaying the test results to the textareas, as well as updating the value of a checkbox depending upon whether it is checked or not. Plus there may be a few other issues hiding out in there that I am not aware of. I have absolutely no javascript skills, as this is the first time I've ever tried to use it. My html skills are very minimal. I've been working on this for over a week now with little luck. I would greatly appreciate any input or insight into how to do what I want to do in an efficient manner. Thank you very much for looking!

    Frank

    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <!-- InstanceBeginEditable name="doctitle" -->
    <title>IDR-04 Test Integrator</title>
    <!-- InstanceEndEditable -->
    <!-- InstanceBeginEditable name="head" -->
    
    <script language="Javascript">
    
    		  var testPlan = {testLevel:1, halt:2, loop:2, output:1, run:1, count:0, results:"!second", clock:" --- ", ipa:" 10.0.0.5 ", pst:" --- "};
    		  
    		  var test1Object = {display:1, status:0, enabled:0, name:"Test 1: Testing", result:"second"};
    		  var test2Object = {display:1, status:0, enabled:0, name:"Test 2: Testing", result:"first"};
    		  var test3Object = {display:1, status:0, enabled:0, name:"Test 3: Testing", result:"first"};
    		  var test4Object = {display:1, status:0, enabled:0, name:"Test 4: Testing", result:"first"};
    		  var test5Object = {display:1, status:0, enabled:0, name:"Test 5: Testing", result:"first"};
    		  var test6Object = {display:1, status:0, enabled:0, name:"Test 6: Testing", result:"first"};
    		  var test7Object = {display:1, status:0, enabled:0, name:"Test 7: Testing", result:"first"};
    		  var test8Object = {display:1, status:0, enabled:0, name:"Test 8: Testing", result:"first"};
    		  var test9Object = {display:1, status:0, enabled:0, name:"Test 9: Testing", result:"first"};
    		  var test10Object = {display:1, status:0, enabled:0, name:"Test 10: Testing", result:"first"};
    		  var test11Object = {display:1, status:0, enabled:0, name:"Test 11: Testing", result:"first"};
    		  var test12Object = {display:1, status:0, enabled:0, name:"Test 12: Testing", result:"first"};
    		  var test13Object = {display:1, status:0, enabled:0, name:"Test 13: Testing", result:"first"};
    		  var test14Object = {display:1, status:0, enabled:0, name:"Test 14: Testing", result:"first"};
    		  var test15Object = {display:1, status:0, enabled:0, name:"Test 15: Testing", result:"first"};
    		  var test16Object = {display:1, status:0, enabled:0, name:"Test 16: Testing", result:"first"};
    		  
    		  var resultsTest = "!second";	 	// results of all tests run
          	  //var elem = document.getElementByID('textOut');
    		  window.document.form1.textOut.value = resultsTest;
    		  //var oldText = elem.replaceChild(resultsTest, elem.firstChild);
    		  
    	  
    	  function start() 
    	  {
    	      var RTCvalue = document.createTextNode(" --- ");
    	   	  var elem = document.getElementById('RTC');
    		  var oldText = elem.replaceChild(RTCvalue, elem.firstChild);
    	  }
    	
    	  onload = start;
    
          function amIChecked(evt)
    	  {
    	    evt = (evt) ? evt : ((window.event) ? event : null);
    		if (evt)
    		{
    	   	 var target = (evt.target)? evt.target : ((evt.srcElement) ? evt.srcElement : null);
    		 if (target)
    		 {
    	      var checkBoxArray = ["cb0", "cb1", "cb2", "cb3", "cb4", "cb5", "cb6", "cb7", "cb8", "cb9", "cb10", "cb11", "cb12", "cb13", "cb14", "cb15"];
    		  var i = 0;
    		
    	      for (i = 0; i < 16; i++)
    	      {   
    	   	   	  if (document.form1.checkBoxArray[i].checked == true) document.form1.checkBoxArray[i].value = "C"; 
    			  else document.form1.checkBoxArray[i].value = "N";
    	      }
    	  	 }
    	   }
    	  }
    	  
    	  function displayStatus(status)
    	  {
    	   switch (status)
    	   {
    	   	case 0:  return '---';	  //none
    		case 1:  return ' R ';	  //running
    		case 2:  return ' P ';	  //pass
    		case 3:  return ' F ';	  //fail
    		default: return 'XXX';	  // should never occur
    	   }
    	  }
       </script>
       
    </head>
    <body bgcolor="#ffba00">
    <form name="form1" id="form1" method="test" >
    <p align="left">
    <table border="0">
      <tr>
        <td>
    		<img height="60" alt="" src="logo.gif" width="168" border="0"><br>
    		<font face="Raavi" size="4"><strong>IDR-04 Test Integrator</strong></font><br>
    		<font face="System" size="2">
    		<br>Clock H:M:S <input name="RTC" id="RTC" style="WIDTH: 92px; HEIGHT: 21px" size="15" value="" onclick="return false" readonly="">   IP Address:<input name="IPA" id="IPA" style="LEFT: 270px; WIDTH: 102px; TOP: 138px; HEIGHT: 21px" size="12" value=testPlan.ipa onclick="return false" readonly=""><br>
    		<br>TCP Packet Stats:<br><input name="PS" id="PS" style="WIDTH: 363px; HEIGHT: 21px" size="15" value=document.write(testPlan.pst) onclick="return false" readonly="">
    		<br><br>Test Action:<br><select name="TM" id="TM" style="WIDTH: 327px" onchange="TMDisplay(this)"><option value="1" selected="selected"> Run Production Board Test  (Use FN xxx)       </option><option value="2"> Run ESS Unit Test  (Use FN xxx) </option><option value="3"> Basic Board Test (No Fixture) </option><option value="4"> Debug - Select Tests From List </option></select><br><select name="ERR" id="ERR"><option value="1" selected="selected"> Halt On Error </option><option value="2"> Continue on Error </option></select><select name="LOOP" id="LOOP"><option value="1" selected="selected"> Run Once </option><option value="2"> Loop Test </option></select><select name="OUTPUT" style="WIDTH: 116px" id="OUTPUT"><option value="1" selected="selected"> Brief Output </option><option value="2"> Verbose Output </option></select><br><br>        <input type="radio" name="Action" value="Run" style="WIDTH: 36px; HEIGHT: 36px" size="36">RUN***<input type="radio" name="Action" value="Stop" style="WIDTH: 36px; HEIGHT: 36px" size="36" checked="checked">HALT<input style="Z-INDEX: 101; LEFT: 190px; WIDTH: 150px; POSITION: absolute; TOP: 315px; HEIGHT: 30px" type="submit" size="102" value="Load Configuration"><br><br><input name="LOOPCNT" style="WIDTH: 125px; HEIGHT: 21px" size="17" value=testPlan.count readonly="">  Test Loop Count</font><font size="2"><br><br>Test Results:<br><textarea id="textOut" name="textOut" style="WIDTH: 365px; HEIGHT: 225px" rows="15" readonly="" cols="41"></textarea>
    		</font>
    	</td>
    	<td><font face="System" size="2">Test Selection:<br></font>
    		<table border="0">
            	   <tr><td width="31"><p align="center"><script type="text/javascript">document.write(displayStatus(test1Object.status))</script></p></td><td width="33"><p align="center"><input style="WIDTH: 15px; HEIGHT: 30px" type="checkbox" size="15" value="N" name="CB0" id="cb0" onclick="amIChecked(event)"></p></td><td><p align="left"><font face="System" size="1"><script type="text/javascript">document.write(test3Object.name)</script></font></p></td></tr>
            	   <tr><td width="31"><p align="center"><script type="text/javascript">document.write(displayStatus(test2Object.status))</script></p></td><td width="33"><p align="center"><input style="WIDTH: 15px; HEIGHT: 30px" type="checkbox" size="15" value="N" name="CB1" id="cb1" onclick="amIChecked(event)"></p></td><td><p align="left"><font face="System" size="1"><script type="text/javascript">document.write(test3Object.name)</script></font></p></td></tr>
            	   <tr><td width="31"><p align="center"><script type="text/javascript">document.write(displayStatus(test3Object.status))</script></p></td><td width="33"><p align="center"><input style="WIDTH: 15px; HEIGHT: 30px" type="checkbox" size="15" value="N" name="CB2" id="cb2" onclick="amIChecked(event)"></p></td><td><p align="left"><font face="System" size="1"><script type="text/javascript">document.write(test3Object.name)</script></font></p></td></tr>
            	   <tr><td width="31"><p align="center"><script type="text/javascript">document.write(displayStatus(test4Object.status))</script></p></td><td width="33"><p align="center"><input style="WIDTH: 15px; HEIGHT: 30px" type="checkbox" size="15" value="N" name="CB3" id="cb3" onclick="amIChecked(event)"></p></td><td><p align="left"><font face="System" size="1"><script type="text/javascript">document.write(test4Object.name)</script></font></p></td></tr>
            	   <tr><td width="31"><p align="center"><script type="text/javascript">document.write(displayStatus(test5Object.status))</script></p></td><td width="33"><p align="center"><input style="WIDTH: 15px; HEIGHT: 30px" type="checkbox" size="15" value="N" name="CB4" id="cb4" onclick="amIChecked(event)"></p></td><td><p align="left"><font face="System" size="1"><script type="text/javascript">document.write(test5Object.name)</script></font></p></td></tr>
           		   <tr><td width="31"><p align="center"><script type="text/javascript">document.write(displayStatus(test6Object.status))</script></p></td><td width="33"><p align="center"><input style="WIDTH: 15px; HEIGHT: 30px" type="checkbox" size="15" value="N" name="CB5" id="cb5" onclick="amIChecked(event)"></p></td><td><p align="left"><font face="System" size="1"><script type="text/javascript">document.write(test6Object.name)</script></font></p></td></tr>
            	   <tr><td width="31"><p align="center"><script type="text/javascript">document.write(displayStatus(test7Object.status))</script></p></td><td width="33"><p align="center"><input style="WIDTH: 15px; HEIGHT: 30px" type="checkbox" size="15" value="N" name="CB6" id="cb6" onclick="amIChecked(event)"></p></td><td><p align="left"><font face="System" size="1"><script type="text/javascript">document.write(test7Object.name)</script></font></p></td></tr>
            	   <tr><td width="31"><p align="center"><script type="text/javascript">document.write(displayStatus(test8Object.status))</script></p></td><td width="33"><p align="center"><input style="WIDTH: 15px; HEIGHT: 30px" type="checkbox" size="15" value="N" name="CB7" id="cb7" onclick="amIChecked(event)"></p></td><td><p align="left"><font face="System" size="1"><script type="text/javascript">document.write(test8Object.name)</script></font></p></td></tr>
            	   <tr><td width="31"><p align="center"><script type="text/javascript">document.write(displayStatus(test9Object.status))</script></p></td><td width="33"><p align="center"><input style="WIDTH: 15px; HEIGHT: 30px" type="checkbox" size="15" value="N" name="CB8" id="cb8" onclick="amIChecked(event)"></p></td><td><p align="left"><font face="System" size="1"><script type="text/javascript">document.write(test9Object.name)</script></font></p></td></tr>
            	   <tr><td width="31"><p align="center"><script type="text/javascript">document.write(displayStatus(test10Object.status))</script></p></td><td width="33"><p align="center"><input style="WIDTH: 15px; HEIGHT: 30px" type="checkbox" size="15" value="N" name="CB9" id="cb9" onclick="amIChecked(event)"></p></td><td><p align="left"><font face="System" size="1"><script type="text/javascript">document.write(test10Object.name)</script></font></p></td></tr>
            	   <tr><td width="31"><p align="center"><script type="text/javascript">document.write(displayStatus(test11Object.status))</script></p></td><td width="33"><p align="center"><input style="WIDTH: 15px; HEIGHT: 30px" type="checkbox" size="15" value="N" name="CB10" id="cb10" onclick="amIChecked(event)"></p></td><td><p align="left"><font face="System" size="1"><script type="text/javascript">document.write(test11Object.name)</script></font></p></td></tr>
            	   <tr><td width="31"><p align="center"><script type="text/javascript">document.write(displayStatus(test12Object.status))</script></p></td><td width="33"><p align="center"><input style="WIDTH: 15px; HEIGHT: 30px" type="checkbox" size="15" value="N" name="CB11" id="cb11" onclick="amIChecked(event)"></p></td><td><p align="left"><font face="System" size="1"><script type="text/javascript">document.write(test12Object.name)</script></font></p></td></tr>
            	   <tr><td width="31"><p align="center"><script type="text/javascript">document.write(displayStatus(test13Object.status))</script></p></td><td width="33"><p align="center"><input style="WIDTH: 15px; HEIGHT: 30px" type="checkbox" size="15" value="N" name="CB12" id="cb12" onclick="amIChecked(event)"></p></td><td><p align="left"><font face="System" size="1"><script type="text/javascript">document.write(test13Object.name)</script></font></p></td></tr>
            	   <tr><td width="31"><p align="center"><script type="text/javascript">document.write(displayStatus(test14Object.status))</script></p></td><td width="33"><p align="center"><input style="WIDTH: 15px; HEIGHT: 30px" type="checkbox" size="15" value="N" name="CB13" id="cb13" onclick="amIChecked(event)"></p></td><td><p align="left"><font face="System" size="1"><script type="text/javascript">document.write(test14Object.name)</script></font></p></td></tr>
            	   <tr><td width="31"><p align="center"><script type="text/javascript">document.write(displayStatus(test15Object.status))</script></p></td><td width="33"><p align="center"><input style="WIDTH: 15px; HEIGHT: 30px" type="checkbox" size="15" value="N" name="CB14" id="cb14" onclick="amIChecked(event)"></p></td><td><p align="left"><font face="System" size="1"><script type="text/javascript">document.write(test15Object.name)</script></font></p></td></tr>
            	   <tr><td width="31"><p align="center"><script type="text/javascript">document.write(displayStatus(test16Object.status))</script></p></td><td width="33"><p align="center"><input style="WIDTH: 15px; HEIGHT: 30px" type="checkbox" size="15" value="N" name="CB15" id="cb15" onclick="amIChecked(event)"></p></td><td><p align="left"><font face="System" size="1"><script type="text/javascript">document.write(test16Object.name)</script></font></p></td></tr>
    		</table>
    	</td>
      </tr>
    </table>
    </p></form>
    </body>
    </form>
    </html>

  2. #2
    razka3's Avatar
    New User

    Status
    Offline
    Join Date
    Sep 2008
    Posts
    10

    Re: using javascript to update checkbox values and write output to textarea dynamical

    Well, I've figured out a bunch of it now, by accident. Gotta love that. However, I am still stuck on the check box issue. When a check box is updated (checked or unchecked), I want a function to be called amIChecked(evt). This then iterates through all 16 check boxes and if they are checked, changes the value of the check box to "C", if not then to "N". I need to change these values because they are submitted with the posting of the form to the server, which then parses these values out and does some tasks based on which were checked. Any insight into this?

    Code:
          function amIChecked(evt)
    	  {
    	    evt = (evt) ? evt : ((window.event) ? event : null);
    		if (evt)
    		{
    	   	 var target = (evt.target)? evt.target : ((evt.srcElement) ? evt.srcElement : null);
    		 if (target)
    		 {
    	      var checkBoxArray = ["cb0", "cb1", "cb2", "cb3", "cb4", "cb5", "cb6", "cb7", "cb8", "cb9", "cb10", "cb11", "cb12", "cb13", "cb14", "cb15"];
    		  var i = 0;
    		
    	      for (i = 0; i < 16; i++)
    	      {   
    	   	   	  if (document.form1.checkBoxArray[i].checked == true) document.form1.checkBoxArray[i].value = "C"; 
    			  else document.form1.checkBoxArray[i].value = "N";
    	      }
    	  	 }
    	   }
    	  }
    Code:
    <input style="WIDTH: 15px; HEIGHT: 30px" type="checkbox" size="15" value="N" name="CB0" id="cb0" onclick="amIChecked(event)">

  3. #3
    rangana's Avatar
    Moderator/Allstar

    Status
    Offline
    Join Date
    Feb 2008
    Location
    Cebu City Philippines
    Posts
    317

    Re: using javascript to update checkbox values and write output to textarea dynamical

    Why not just check the checkbox status (checked/unchecked) on submit instead?

    Try to add highlighted in your form:
    Code:
    <form name="form1" id="form1" method="test" onsubmit="return updateCheck()">
    ...and have this function:
    Code:
    	function updateCheck(){
    for(var i=0,check=document.getElementById('form1').getElementsByTagName('input');i<check.length;i++){
    check[i].value=(check[i].getAttribute('type')=='checkbox'&&check[i].checked)?'C':'N';
    alert(check[i].value); // Verify the values of the checkbox. You can remove this
    }
    return true;
    	}
    See if it helps.
    Checkout my porfolio.
    Please click the button when a member helped you.
    Take time to use Forum's Search function.

  4. #4
    razka3's Avatar
    New User

    Status
    Offline
    Join Date
    Sep 2008
    Posts
    10

    Re: using javascript to update checkbox values and write output to textarea dynamical

    Thanks, that's a good idea. I'll have to look into it a little more. Now I've got a couple other issues that have crept up do to some changed plans from above. Somehow I need to send the post and receive the response without updating the main page. I guess I need some kind of hidden iframe to do that. How would I communicate between the hidden iframe and the main page? That's my next task... time to research.

  5. #5
    jthayne's Avatar

    Status
    Offline
    Join Date
    Aug 2008
    Location
    Texas
    Posts
    508

    Re: using javascript to update checkbox values and write output to textarea dynamical

    This link may help you with that.

  6. #6
    razka3's Avatar
    New User

    Status
    Offline
    Join Date
    Sep 2008
    Posts
    10

    Re: using javascript to update checkbox values and write output to textarea dynamical

    Hmm, that is interesting. Thanks for posting that link.

    I guess what I need to do is to submit the form from the main page to the hidden iframe, then from the iframe to the server which will return updated values to the iframe. Then the iframe will pass these values back to the main page which will update output.

    Seems a little more complicated that the example... hard to wrap my mind around it I guess.

  7. #7
    razka3's Avatar
    New User

    Status
    Offline
    Join Date
    Sep 2008
    Posts
    10

    Re: using javascript to update checkbox values and write output to textarea dynamical

    Hello all,

    I've just about got everything working now... However, the form seems to be sent via a GET request instead of POST, resulting in a 404 error. It's submitted via a hidden iframe URL replacement. Spent about 5 hours so far today on this, is starting to get irritating!

    Any help would be greatly appreciated!

    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title>IDR-04 Test Integrator</title>
    
    <script type="text/javascript">
          
          var testPlan = {testLevel:${testLevel}, halt:${haltStatus}, loop:${loopStatus}, output:${outputStatus}, run:${runStatus}};
          
          var testObject1 = {display:${testDisplay1}, status:${testStatus1}, enabled:${testEnabled1}, name:"${testName1}", result:"${testResult1}"};
          var testObject2 = {display:${testDisplay2}, status:${testStatus2}, enabled:${testEnabled2}, name:"${testName2}", result:"${testResult2}"};
          var testObject3 = {display:${testDisplay3}, status:${testStatus3}, enabled:${testEnabled3}, name:"${testName3}", result:"${testResult3}"};
          var testObject4 = {display:${testDisplay4}, status:${testStatus4}, enabled:${testEnabled4}, name:"${testName4}", result:"${testResult4}"};
          var testObject5 = {display:${testDisplay5}, status:${testStatus5}, enabled:${testEnabled5}, name:"${testName5}", result:"${testResult5}"};
          var testObject6 = {display:${testDisplay6}, status:${testStatus6}, enabled:${testEnabled6}, name:"${testName6}", result:"${testResult6}"};
          var testObject7 = {display:${testDisplay7}, status:${testStatus7}, enabled:${testEnabled7}, name:"${testName7}", result:"${testResult7}"};
          var testObject8 = {display:${testDisplay8}, status:${testStatus8}, enabled:${testEnabled8}, name:"${testName8}", result:"${testResult8}"};
          var testObject9 = {display:${testDisplay9}, status:${testStatus9}, enabled:${testEnabled9}, name:"${testName9}", result:"${testResult9}"};
          var testObject10 = {display:${testDisplay10}, status:${testStatus10}, enabled:${testEnabled10}, name:"${testName10}", result:"${testResult10}"};
          var testObject11 = {display:${testDisplay11}, status:${testStatus11}, enabled:${testEnabled11}, name:"${testName11}", result:"${testResult11}"};
          var testObject12 = {display:${testDisplay12}, status:${testStatus12}, enabled:${testEnabled12}, name:"${testName12}", result:"${testResult12}"};
          var testObject13 = {display:${testDisplay13}, status:${testStatus13}, enabled:${testEnabled13}, name:"${testName13}", result:"${testResult13}"};
          var testObject14 = {display:${testDisplay14}, status:${testStatus14}, enabled:${testEnabled14}, name:"${testName14}", result:"${testResult14}"};
          var testObject15 = {display:${testDisplay15}, status:${testStatus15}, enabled:${testEnabled15}, name:"${testName15}", result:"${testResult15}"};
          var testObject16 = {display:${testDisplay16}, status:${testStatus16}, enabled:${testEnabled16}, name:"${testName16}", result:"${testResult16}"};
           
          var testObjects = new Array(testObject1, testObject2, testObject3, testObject4, testObject5, testObject6, testObject7, testObject8, testObject9, testObject10, testObject11, testObject12, testObject13, testObject14, testObject15, testObject16);
           var ipAddress = "0.0.0.0";
          
          var IFrameObj; // our IFrame object
     
    <!-- ************************************ -->         
    <!-- *** preload variables and images *** -->                 
    <!-- ************************************ -->    
     
          function start() 
          {      
              if(document.images) preImages("pass.png", "fail.png");
              preVars();
        //      loadPage();
          }
        
          window.onload = start;
          
          function preVars()
          {
            document.form1.textOut.value = "!";
            document.form1.LOOPCNT.value = "0";
            TMDisplay(document.form1.TM);
          }
          
          function preImages()
          {
            var testImages = new Array();
            for (var x = 0; x < preImages.arguments.length; x++)
            {
              testImages[x] = new Image();
              testImages[x].src = preImages.arguments[x];
            }
          }
          
    <!-- ***************************** -->         
    <!-- *** update checkbox value *** -->                 
    <!-- ***************************** -->          
    
          function amIChecked(id)
          {
            if(document.getElementById(id).checked == true) document.getElementById(id).value = "C"; 
            else document.getElementById(id).value = "N";
          }
          
    <!-- *************************** -->         
    <!-- *** display test status *** -->                 
    <!-- *************************** -->          
          
          function displayStatus(status)
          {
           switch (status)
           {
               case 0: return ''; //'<img id="TestStatus" src="None.png" width="40" height="40" alt="No Status" border="0" />';  // No Status
            case 1: return ''; //'<img id="TestStatus" src="Run.png" width="40" height="40" alt="Running" border="0" />';        // Running
            case 2: return '<img id="TestStatus" src="pass.png" width="40" height="40" alt="Passed" border="0" />';     // Passed      
            case 3: return '<img id="TestStatus" src="fail.png" width="40" height="40" alt="Failed" border="0" />';      // Failed
            default: return 'XXX';      // should never occur
           }
          }
          
    <!-- *************************** -->         
    <!-- *** save output to file *** -->                 
    <!-- *************************** -->    
    
          function WriteToFile()
          {
           str = document.form1.textOut.value;
           mydoc = document.open();
           mydoc.write(str);
           mydoc.execCommand("saveAs", true, "IDR04TestIntegratorOutput.txt");
           mydoc.close();
           history.back();
           return false;
          }
          
    <!-- ****************************** -->         
    <!-- *** display drop down menu *** -->                 
    <!-- ****************************** -->    
    
          function TMDisplay(dropdown)
          {
           // clear all check boxes and values...
           for (var i = 0; i < 16; i++)
           { 
             document.getElementById('cb' + i).checked = false; 
             document.getElementById('cb' + i).value = "N"; 
             document.getElementById('cb' + i).disabled = true;
           }
             
           // grab chosen combobox value 
           var selVal = dropdown.options[dropdown.selectedIndex].value; 
           
           if (selVal == 1) // production board test
           {
             document.getElementById('cb0').checked = true; document.getElementById('cb0').value = "C";
             document.getElementById('cb1').checked = true; document.getElementById('cb1').value = "C";
             document.getElementById('cb2').checked = true; document.getElementById('cb2').value = "C";
             document.getElementById('cb3').checked = true; document.getElementById('cb3').value = "C";
             document.getElementById('cb4').checked = true; document.getElementById('cb4').value = "C";
             document.getElementById('cb5').checked = true; document.getElementById('cb5').value = "C";
           } 
           else if (selVal == 2) // ess unit test
           {
             document.getElementById('cb6').checked = true; document.getElementById('cb6').value = "C";
             document.getElementById('cb7').checked = true; document.getElementById('cb7').value = "C";
             document.getElementById('cb8').checked = true; document.getElementById('cb8').value = "C";
             document.getElementById('cb9').checked = true; document.getElementById('cb9').value = "C";
             document.getElementById('cb10').checked = true; document.getElementById('cb10').value = "C";
             document.getElementById('cb11').checked = true; document.getElementById('cb11').value = "C";
           } 
           else if (selVal == 3) // basic board test
           {
             document.getElementById('cb12').checked = true; document.getElementById('cb12').value = "C";
             document.getElementById('cb13').checked = true; document.getElementById('cb13').value = "C";
             document.getElementById('cb14').checked = true; document.getElementById('cb14').value = "C";
             document.getElementById('cb15').checked = true; document.getElementById('cb15').value = "C";
           }
           else if (selVal == 4) // debug mode - hand select tests
           {
               for (var i = 0; i < 16; i++)
               {  
             document.getElementById('cb' + i).disabled = false;
               }
           }
          }
          
    <!-- ************************** -->         
    <!-- *** build query string *** -->                 
    <!-- ************************** -->    
    
          function BuildQueryString(theFormName)
          {
           var theForm = document.forms[theFormName];
           var qs = 'hidden.htm'
           for (var e = 0; e < theForm.elements.length; e++)
           {
            if (theForm.elements[e].name != '')
            {
             qs += (qs == 'hidden.htm') ? '?' : '&'
             qs += theForm.elements[e].name + '=' + escape(theForm.elements[e].value);
            }
           }
           return qs;
          }
               
    <!-- ********************** -->         
    <!-- *** call to server *** -->                 
    <!-- ********************** -->    
    
          function CallToServer(theFormName)
          {
    //       document.testPlan.run = 2;
           document.getElementById('RUNSTATUS').value = "2";
           document.getElementById('TestControl').disabled = true;
           
           // enable all check boxes before sending POST
           for (var i = 0; i < 16; i++) document.getElementById('cb' + i).disabled = false;
          
           if (!document.createElement) {return true};
             var IFrameDoc;
           
           // build POST URL
           var URL = BuildQueryString(theFormName);
           document.getElementById('textOut').value = URL;              // TESTING URL BUILD ***********************************
           
           // build iframe
             if (!IFrameObj && document.createElement) 
           {
                 // create the IFrame and assign a reference to the
              // object to our global variable IFrameObj.
              // this will only happen the first time 
              // callToServer() is called
                 try 
              {
                      var tempIFrame=document.createElement('iframe');
                    tempIFrame.setAttribute('id','RSIFrame');
                  tempIFrame.setAttribute('name','RSIFrame');
                    tempIFrame.setAttribute('src','hidden.htm');
                    tempIFrame.style.border='0px';
                    tempIFrame.style.width='0px';
                    tempIFrame.style.height='0px';
                    IFrameObj = document.body.appendChild(tempIFrame);
          
                    if (document.frames) IFrameObj = document.frames['RSIFrame'];                     // for IE5 Mac
               } 
               catch(exception) // for IE5 PC
               {
                  iframeHTML='\<iframe name="RSIFrame" id="RSIFrame" src="hidden.htm" style="';
                  iframeHTML+='border:0px;';
                  iframeHTML+='width:0px;';
                  iframeHTML+='height:0px;';
                  iframeHTML+='"><\/iframe>';
                  document.body.innerHTML+=iframeHTML;
                  IFrameObj = new Object();
                  IFrameObj.document = new Object();
                  IFrameObj.document.location = new Object();
                  IFrameObj.document.location.iframe = document.getElementById('RSIFrame');
                  IFrameObj.document.location.replace = function(location) { this.iframe.src = location; }
               }
              }
              
              if (navigator.userAgent.indexOf('Gecko') !=-1 && !IFrameObj.contentDocument)        // for NS6
            {
              setTimeout('callToServer()',10); // pause
              return false;
              }
      
            if (IFrameObj.contentDocument) IFrameDoc = IFrameObj.contentDocument;              // for NS6
            else if (IFrameObj.contentWindow) IFrameDoc = IFrameObj.contentWindow.document; // For IE5.5 and IE6 
            else if (IFrameObj.document) IFrameDoc = IFrameObj.document;                     // For IE5
            else return true;
    
              // disable all check boxes after sending POST
              for (var i = 0; i < 16; i++) document.getElementById('cb' + i).disabled = true;
      
              // send URL to iframe for POSTing
              IFrameDoc.location.replace(URL);
            
              return false;
    }
            
    <!-- *********************************************** -->         
    <!-- *** handle response from server->hidden.htm *** -->                 
    <!-- *********************************************** -->    
          
          function HandleResponse(doc)
          {
           var iframe = document.getElementById('RSIFrame');
           
           document.testPlan = iframe.contentWindow['testPlan'];
           document.testObjects = iframe.contentWindow['testObjects'];
           
           document.testObject1 = iframe.contentWindow['testObject1'];
           document.testObject2 = iframe.contentWindow['testObject2'];
           document.testObject3 = iframe.contentWindow['testObject3'];
           document.testObject4 = iframe.contentWindow['testObject4'];
           document.testObject5 = iframe.contentWindow['testObject5'];
           document.testObject6 = iframe.contentWindow['testObject6'];
           document.testObject7 = iframe.contentWindow['testObject7'];
           document.testObject8 = iframe.contentWindow['testObject8'];
           document.testObject9 = iframe.contentWindow['testObject9'];
           document.testObject10 = iframe.contentWindow['testObject10'];
           document.testObject11 = iframe.contentWindow['testObject11'];
           document.testObject12 = iframe.contentWindow['testObject12'];
           document.testObject13 = iframe.contentWindow['testObject13'];
           document.testObject14 = iframe.contentWindow['testObject14'];
           document.testObject15 = iframe.contentWindow['testObject15'];
           document.testObject16 = iframe.contentWindow['testObject16'];
           
           document.getElementById('form1').textOut.value = document.testPlan.results;
           document.getElementById('form1').LOOPCNT.value = document.testPlan.count;
           
           // setTimeout(100);
           CheckStatus(); // check status of tests run...
    
           document.getElementById('TestControl').disabled = false;       
          }
          
    <!-- ************************************* -->         
    <!-- *** check overall status of tests *** -->                 
    <!-- ************************************* -->          
          
          function CheckStatus()
          {
           var failed = false;
           document.getElementById('AllTestStatus').style.color = "green";
           var i = 0;
           while (i < 16)
           {
               if (testObjects[i].status == 3)
            { 
             document.getElementById('AllTestStatus').style.color = "red";
             failed = true;
             i++;
            }
            else i++;
           }
           if (failed == true) document.getElementById('AllTestStatus').value = "FAILURE!";
           else document.getElementById('AllTestStatus').value = "SUCCESS!";
          }
          
    <!-- **************************************** -->         
    <!-- *** input IP Addy and load main page *** -->                 
    <!-- **************************************** -->    
    
          function loadPage()
          {
    //       var ip1 = document.getElementById('IP1').value;
    //       var ip2 = document.getElementById('IP2').value;
    //       var ip3 = document.getElementById('IP3').value;
    //       var ip4 = document.getElementById('IP4').value;
           
    //       document.ipAddress = ip1.toString() + '.' + ip2.toString() + '.' + ip3.toString() + '.' + ip4.toString();
    //       document.getElementById('Page').removeChild(document.getElementById('IPPrompt'));
    //       document.getElementById('mainPage').style.visibility = "visible";
    //       alert(document.ipAddress);
           document.getElementById('slowScreenSplash').style.display = "none";
           document.getElementById('mainPage').style.visibility = "visible";
          }
          
    <!-- ******************** -->         
    <!-- *** clear output *** -->                 
    <!-- ******************** -->    
          
          function ClearOutput()
          {
           document.getElementById('textOut').value = "!";
           return false;
          }
          
    </script>
       
    <!-- ****************** -->         
    <!-- *** start HTML *** -->                 
    <!-- ****************** -->    
    
    </head>
    <body bgcolor="#ffba00">
    <div id="Page">
    
    <!--
    <div align="center" id="IPPrompt" style="visibility: hidden">
    <form name="ipform" id="ipform"><font size="6">
    Enter IP Address of Board:</font><br><input id="IP1" name="IP1" style="WIDTH: 60px; HEIGHT: 21px" size="4">&nbsp;<font>.</font>&nbsp;<input id="IP2" name="IP2" style="WIDTH: 60px; HEIGHT: 21px" size="4">&nbsp;<font>.</font>&nbsp;<input id="IP3" name="IP3" style="WIDTH: 60px; HEIGHT: 21px" size="4">&nbsp;<font>.</font>&nbsp;<input id="IP4" name="IP4" style="WIDTH: 60px; HEIGHT: 21px" size="4">
    <input type="button" value="Submit" style="LEFT: 108px; WIDTH: 150px; TOP: 568px; HEIGHT: 30px" onclick="loadPage()">
    </form>
    </div>
    -->
    
    <div id="slowScreenSplash" Style="position:absolute;z-index:5;top:40%;left:15%;visibility:hidden" align="center">
    Please wait while page loads...
    </div>
    
    <div id="mainPage" style="visibility: visible">
    <form name="form1" id="form1" onsubmit="return CallToServer(this.name)" action="" method="POST">
    <table border="0">
      <tr>
        <td>
            <font face="Raavi" size="6"><strong>Wabtec IDR-04 Test Integrator</strong></font>
            <font face="System" size="2"><br>
            Test Action:<br><select id="TM" style="WIDTH: 359px" onchange="TMDisplay(this.form.TM)" name="TM"><option value="1" selected>Run Production Board Test (Use FN xxx)</option><option value="2">Run Top Level Unit Test (Use FN xxx)</option>
            <option value="3">Basic Board Test (No Fixture)</option><option value="4">Debug - Select Tests From List</option></select>
            <br><select id="ERR" name="ERR" style="WIDTH: 143px"><option value="1" selected>Halt On Error</option><option value="2">Continue on Error</option></select><select id="LOOP" name="LOOP" style="WIDTH: 96px"><option value="1" selected>Run Once</option><option value="2">Loop 
            Test</option></select><select id="OUTPUT" style="WIDTH: 120px" name="OUTPUT"><option value="1" selected>Brief Output</option><option value="2">Verbose Output</option></select>
            <br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            <input type="submit" id="TestControl" style="LEFT: 120px; TOP: 165px WIDTH: 150px; HEIGHT: 30px" alt="Start Test" size="102" value="Start Testing">
            <br><br><input id="LOOPCNT" name="LOOPCNT" style="WIDTH: 38px; HEIGHT: 21px" size="4" readonly> Test Loop Count</font>
            <font size="2"><br><br>Test Results:<br><textarea id="textOut" style="WIDTH: 365px; HEIGHT: 225px" name="textOut" rows="15" readonly cols="41"></textarea><br>
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            <input style="LEFT: 108px; WIDTH: 150px; TOP: 568px; HEIGHT: 30px" onclick="return ClearOutput()" type="submit" size="102" value="Clear Test Results">
            &nbsp;&nbsp;
            <input style="LEFT: 108px; WIDTH: 150px; TOP: 568px; HEIGHT: 30px" onclick="return WriteToFile()" type="submit" size="102" value="Save Test Results"><br>
              <input type="hidden" name="RUNSTATUS" id="RUNSTATUS" value="1">
            <br>
            <br>
            <table width="100%" border="0">
             <tr>
              <td width="133"><font size="4">Status of Tests:</font></td>
              <td>&nbsp;<input id="AllTestStatus" name="AllTestStatus" style="WIDTH: 85px; HEIGHT: 21px; color: black; font-weight: bold" size="6" readonly value="No Tests Run"></font></td>
             </tr>
            </table>
            </font>
        </td>
        <td><font face="System" size="2">&nbsp;&nbsp;&nbsp;Test Selection:<br></font>
            <table border="0">
                   <tr><td width="31"><p align="center"><script type="text/javascript">document.write(displayStatus(testObject1.status))</script></p></td><td width="33"><p align="center"><input style="WIDTH: 15px; HEIGHT: 30px" type="checkbox" size="15" name="CB0" id="cb0" onclick="amIChecked(this.id)"></p></td><td><p align="left"><font face="System" size="1"><script type="text/javascript">document.write(testObject1.name)</script></font></p></td></tr>
                   <tr><td width="31"><p align="center"><script type="text/javascript">document.write(displayStatus(testObject2.status))</script></p></td><td width="33"><p align="center"><input style="WIDTH: 15px; HEIGHT: 30px" type="checkbox" size="15" name="CB1" id="cb1" onclick="amIChecked(this.id)"></p></td><td><p align="left"><font face="System" size="1"><script type="text/javascript">document.write(testObject2.name)</script></font></p></td></tr>
                   <tr><td width="31"><p align="center"><script type="text/javascript">document.write(displayStatus(testObject3.status))</script></p></td><td width="33"><p align="center"><input style="WIDTH: 15px; HEIGHT: 30px" type="checkbox" size="15" name="CB2" id="cb2" onclick="amIChecked(this.id)"></p></td><td><p align="left"><font face="System" size="1"><script type="text/javascript">document.write(testObject3.name)</script></font></p></td></tr>
                   <tr><td width="31"><p align="center"><script type="text/javascript">document.write(displayStatus(testObject4.status))</script></p></td><td width="33"><p align="center"><input style="WIDTH: 15px; HEIGHT: 30px" type="checkbox" size="15" name="CB3" id="cb3" onclick="amIChecked(this.id)"></p></td><td><p align="left"><font face="System" size="1"><script type="text/javascript">document.write(testObject4.name)</script></font></p></td></tr>
                   <tr><td width="31"><p align="center"><script type="text/javascript">document.write(displayStatus(testObject5.status))</script></p></td><td width="33"><p align="center"><input style="WIDTH: 15px; HEIGHT: 30px" type="checkbox" size="15" name="CB4" id="cb4" onclick="amIChecked(this.id)"></p></td><td><p align="left"><font face="System" size="1"><script type="text/javascript">document.write(testObject5.name)</script></font></p></td></tr>
                      <tr><td width="31"><p align="center"><script type="text/javascript">document.write(displayStatus(testObject6.status))</script></p></td><td width="33"><p align="center"><input style="WIDTH: 15px; HEIGHT: 30px" type="checkbox" size="15" name="CB5" id="cb5" onclick="amIChecked(this.id)"></p></td><td><p align="left"><font face="System" size="1"><script type="text/javascript">document.write(testObject6.name)</script></font></p></td></tr>
                   <tr><td width="31"><p align="center"><script type="text/javascript">document.write(displayStatus(testObject7.status))</script></p></td><td width="33"><p align="center"><input style="WIDTH: 15px; HEIGHT: 30px" type="checkbox" size="15" name="CB6" id="cb6" onclick="amIChecked(this.id)"></p></td><td><p align="left"><font face="System" size="1"><script type="text/javascript">document.write(testObject7.name)</script></font></p></td></tr>
                   <tr><td width="31"><p align="center"><script type="text/javascript">document.write(displayStatus(testObject8.status))</script></p></td><td width="33"><p align="center"><input style="WIDTH: 15px; HEIGHT: 30px" type="checkbox" size="15" name="CB7" id="cb7" onclick="amIChecked(this.id)"></p></td><td><p align="left"><font face="System" size="1"><script type="text/javascript">document.write(testObject8.name)</script></font></p></td></tr>
                   <tr><td width="31"><p align="center"><script type="text/javascript">document.write(displayStatus(testObject9.status))</script></p></td><td width="33"><p align="center"><input style="WIDTH: 15px; HEIGHT: 30px" type="checkbox" size="15" name="CB8" id="cb8" onclick="amIChecked(this.id)"></p></td><td><p align="left"><font face="System" size="1"><script type="text/javascript">document.write(testObject9.name)</script></font></p></td></tr>
                   <tr><td width="31"><p align="center"><script type="text/javascript">document.write(displayStatus(testObject10.status))</script></p></td><td width="33"><p align="center"><input style="WIDTH: 15px; HEIGHT: 30px" type="checkbox" size="15" name="CB9" id="cb9" onclick="amIChecked(this.id)"></p></td><td><p align="left"><font face="System" size="1"><script type="text/javascript">document.write(testObject10.name)</script></font></p></td></tr>
                   <tr><td width="31"><p align="center"><script type="text/javascript">document.write(displayStatus(testObject11.status))</script></p></td><td width="33"><p align="center"><input style="WIDTH: 15px; HEIGHT: 30px" type="checkbox" size="15" name="CB10" id="cb10" onclick="amIChecked(this.id)"></p></td><td><p align="left"><font face="System" size="1"><script type="text/javascript">document.write(testObject11.name)</script></font></p></td></tr>
                   <tr><td width="31"><p align="center"><script type="text/javascript">document.write(displayStatus(testObject12.status))</script></p></td><td width="33"><p align="center"><input style="WIDTH: 15px; HEIGHT: 30px" type="checkbox" size="15" name="CB11" id="cb11" onclick="amIChecked(this.id)"></p></td><td><p align="left"><font face="System" size="1"><script type="text/javascript">document.write(testObject12.name)</script></font></p></td></tr>
                   <tr><td width="31"><p align="center"><script type="text/javascript">document.write(displayStatus(testObject13.status))</script></p></td><td width="33"><p align="center"><input style="WIDTH: 15px; HEIGHT: 30px" type="checkbox" size="15" name="CB12" id="cb12" onclick="amIChecked(this.id)"></p></td><td><p align="left"><font face="System" size="1"><script type="text/javascript">document.write(testObject13.name)</script></font></p></td></tr>
                   <tr><td width="31"><p align="center"><script type="text/javascript">document.write(displayStatus(testObject14.status))</script></p></td><td width="33"><p align="center"><input style="WIDTH: 15px; HEIGHT: 30px" type="checkbox" size="15" name="CB13" id="cb13" onclick="amIChecked(this.id)"></p></td><td><p align="left"><font face="System" size="1"><script type="text/javascript">document.write(testObject14.name)</script></font></p></td></tr>
                   <tr><td width="31"><p align="center"><script type="text/javascript">document.write(displayStatus(testObject15.status))</script></p></td><td width="33"><p align="center"><input style="WIDTH: 15px; HEIGHT: 30px" type="checkbox" size="15" name="CB14" id="cb14" onclick="amIChecked(this.id)"></p></td><td><p align="left"><font face="System" size="1"><script type="text/javascript">document.write(testObject15.name)</script></font></p></td></tr>
                   <tr><td width="31"><p align="center"><script type="text/javascript">document.write(displayStatus(testObject16.status))</script></p></td><td width="33"><p align="center"><input style="WIDTH: 15px; HEIGHT: 30px" type="checkbox" size="15" name="CB15" id="cb15" onclick="amIChecked(this.id)"></p></td><td><p align="left"><font face="System" size="1"><script type="text/javascript">document.write(testObject16.name)</script></font></p></td></tr>
            </table>
        </td>
      </tr>
    </table>
    </form>
    </div>
    </div>
    </body>
    </html>