Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

document.table_id DOM object

Status
Not open for further replies.

ScrabbleKing

Programmer
Mar 11, 2007
20
0
0
US
I have forms created that I want to put in the 'display' section of the code. I know you cannot place a form within a form (thus, when I try, my code below no longer functions properly). How do I add a document.table_id DOM object to accomplish what the code below does so that when I add a form to the 'display' everything will still function properly?
Code:
<html>
<head>
  
<SCRIPT LANGUAGE="JavaScript"><!--

function Cng(obj,nme){
 var frm=obj.form;
 var val=obj.value;
 var opts=[];
 if (obj.type=='radio') opts=document.getElementById(nme).options;
 else {
  var zxcrads=document.getElementsByTagName('BODY')[0].getElementsByTagName('INPUT');
  for (var zxc0=0;zxc0<zxcrads.length;zxc0++){
   if (zxcrads[zxc0].name==nme) opts.push(zxcrads[zxc0]);
  }
 }
 for (var zxc0=0;zxc0<opts.length;zxc0++){
  if (opts[zxc0].value==obj.value){
   if (obj.type=='radio') frm[nme].selectedIndex=zxc0;
   else frm[nme][zxc0].checked=true;
   break;
  }
 }
}

// -->
</script>
</head>

<body>

<form>
<table border="0" width="759" height="130">
  <tr>
    <td id="logo" width="20%" valign="top">
<img border="1" src="PIECIN1.jpg" width="132" height="80">
<select id="Sel2"  onchange="Cng(this,'Selection');" >
     <option value="123" >Or Use 123</option>
     <option value="456" >Or Use 456</option>
     <option value="789" >Or Use 789</option>
     <option value="7891" >Or Use 7891</option>
     </select>
    </td>
    <td id="spacer" width="5%" ></td>
    <td id="display" >
    
    // I WILL BE PUTTING A FORM IN HERE
    
    </td>
  </tr>
</table>

<table>
  <tr>
    <td width="800" align="center">
    <input type="radio" CHECKED name="Selection" value="123" onclick="Cng(this,'Sel2');"> 123<br>
    <input type="radio" name="Selection" value="456" onclick="Cng(this,'Sel2');"> 456<br>
    <input type="radio" name="Selection" value="7893" onclick="Cng(this,'Sel2');"> 7893<br>
    <input type="radio" name="Selection" value="789" onclick="Cng(this,'Sel2');"> 789<br>
    </td>
  </tr>
</table>
</form>
</body>

</html>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top