Location: PHPKode > projects > NetLink > netlink_os/egap/table.php
<head>
<title>
iTable&copy; - Rotide Egap
</title>
</head>

<style type='text/css'>
INPUT[type='text']{
  border: 1px black solid;
}
acronym{
  border-bottom: 1px black dashed;
}
.spacer{
  width: 40px;
}
</style>
<script type='text/javascript'>
function start()
{
  document.forms[0].rows.focus();
}
function create_code()
{
  //Rows for table
  rows=document.getElementById("rows").value;
  if (rows=="")
    rows=1;
  //Columns for table
  cols=document.getElementById("cols").value;
  if (cols=="")
    cols=1;
  //border thickness
  border=document.getElementById("border").value;
  if (border=="")
    border=1;
  //cellspacing
  cellspacing=document.getElementById("cs").value;
  if (cellspacing=="")
    cellspacing=0;
  //cellpadding
  cellpadding=document.getElementById("cp").value;
  if (cellpadding=="")
    cellpadding=0;
  //width of table
  width=document.getElementById("width").value;
  if (width=="")
    width=50;  

  box = document.forms[0].width_style;
	width_type = box.options[box.selectedIndex].value;

		if (document.table.align_t[0].checked==true)
    align_t='left';
  else if (document.table.align_t[1].checked==true)
    align_t='center';
  else if (document.table.align_t[2].checked==true)
    align_t='right';
	
	//alert("ALIGN_T:"+align_t);
	if (document.table.align_c[0].checked==true)
    align_c='left';
  else if (document.table.align_c[1].checked==true)
    align_c='center';
  else if (document.table.align_c[2].checked==true)
    align_c='right';
    
	//alert("ALIGN_C:"+align_c)
	
  code="<div align='"+align_t+"'>\n";
  code+="<table width='"+width+width_type+"' border='"+border+"' ";
  //alert(b_width+":"+b_theme+":"+b_color);
  //if (b_width!="2px")&&(b_theme!="solid")&&(b_color!="000000")
    //code+="style='border: "+b_width+" "+b_theme+" #"+b_color";
  code+=">\n";
  x=1;
  for (x==1; x<=rows; x++)
  {
    code+="\t<tr>\n";
    i=1;
    for (i==1; i<=cols; i++)
    { 	
      var chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz";
      var randomstring = '';
      for (var k=0; k<=3; k++) {
        var rnum = Math.floor(Math.random() * chars.length);
        randomstring += chars.substring(rnum,rnum+1);
      }
    code+="\t\t<td id='"+randomstring+"' onclick='cell_content(this)' style='text-align:"+align_c+";'>"+i+"</td>\n";}
    code+="\t</tr>\n";
  }
  code+="</table>\n</div>";
  
  
  //get the value of the textbox code
  p_code=window.opener.document.forms[0].egap_b_code.value
  //alert(p_code.charAt(1));
  if (p_code.charAt(1)=="&")
    p_code=code;
  //put the "code" into the textarea
  window.opener.document.forms[0].egap_b_code.value=p_code
  //transfer to DIV tag
  preview_code=window.opener.document.getElementById("preview").innerHTML
  preview_code+=code
  //alert(preview_code)
  window.opener.document.getElementById("preview").innerHTML=preview_code
  window.opener.document.getElementById("saved").innerHTML="<span style='color: #CC0000;'>Not Saved</span>";
  window.opener.document.getElementById("egap_b_code").value="";
  window.opener.document.getElementById("egap_b_code").value=preview_code
  self.close();
}

</script>

<body OnLoad='start()'>
<link media="screen" type="text/css" rel="stylesheet"  href="../main.css" />

<div align='center'>
<img src='pix/itable_w.png' alt=''/><br/>
c/o R<small>OTIDE</small> E<small>GAP</small>
</div>
<br/>
<div style='font-size: 10pt;'>
Fill in the below form with the information you want, then click <b>Add Table</b>.
</div>
<br/>
<form method='post' action='javascript: create_code()' name='table'>
<table summary='pic_table' border='0' width='98%' >
  <tr>
    <td style='border: 2px black solid;'>
    <form method='post' action=''>
      <table summary='table' border='0'>
        <tr>
          <td>Rows*:</td>
          <td><input type='text' maxlength='2' size='4' id='rows' name='rows' tabindex='1'/></td>
          <td class='spacer'/>
          <td><acronym title='Cell Spacing: The space between the cells'>Cell Spacing</acronym>:</td>
          <td><input type='text' maxlength='2' size='4' id='cs' name='cs' tabindex='4'/> px</td>
          
          <td rowspan='4'>
            Table Alignment:
            <br/>
            <input type='radio' name='align_t' id='align_t' value='left' checked='checked'/> Left<br/>
            <input type='radio' name='align_t' id='align_t' value='center'/> Center<br/>
            <input type='radio' name='align_t' id='align_t' value='right'/> Right
          </td>
          <td rowspan='4'>
            Cell Alignment:
            <br/>
            <input type='radio' name='align_c' id='align_c' value='left' checked='checked'/> Left<br/>
            <input type='radio' name='align_c' id='align_c' value='center'/> Center<br/>
            <input type='radio' name='align_c' id='align_c' value='right'/> Right
          </td>
        </tr>
        <tr>
          <td>Columns*:</td>
          <td><input type='text' maxlength='2' size='4' id='cols' name='cols' tabindex='2'/></td>
          <td class='spacer'/>
          <td><acronym title='Cell Padding: The space between the edge of the cell and the content'>
            Cell Padding</acronym>:
          </td>
          <td><input type='text' maxlength='2' size='4' id='cp' name='cp' tabindex='5'/> px</td>
        </tr>
        <tr>
          <td>Border:</td>
          <td><input type='text' maxlength='2' size='4' id='border' name='border' tabindex='3'/></td>
          <td class='spacer'/>
          <td>Width:</td>
          <td><input type='text' maxlength='3' size='4' id='width' name='width' tabindex='6'/>
          <select id='width_style' name='width_style'>
            <option value='%'>%</option>
            <option value='px'>px</option>
          </select>          
          </td>
          
        </tr>
        <!--
        <tr id='bs'>
          <td>Border<br/>Style:</td>
          <td colspan='3'>
            <?php
              echo "Width: ";
              include("border_style_width");
              echo "<br/>\n";
              echo "Style: ";
              include("border_style_theme");
              echo "<br/>\n";
              echo "Color: ";
              include("border_style_color");
            ?>
          </td>
        </tr>
        -->
      </table>
    
    </td>

  </tr>
  <tr>
    <td colspan='2' align='center'>
      <input type='submit' value='Add Table' style='font-weight: bold'  tabindex='7'/>
      &nbsp;&nbsp;&nbsp;
      <input type='reset' value='Reset Form' onclick='start()' tabindex='8'/>
      &nbsp;&nbsp;&nbsp;
      <button value='Cancel' onclick='window.close()'  tabindex='9'>Cancel Table</button>
    </td>
  </tr>
</table>
</form>
Return current item: NetLink