469,645 Members | 1,150 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,645 developers. It's quick & easy.

runtime input boxes

omerbutt
638 512MB
hi there i am working on an inventory rpoject and for that i have made a stock entry form which is pasted below,I have included this form in the main Add Stock page, having the following inputs to be saved
1.code no
2part no
3total replace no's--------->this is wot the ques is about
4auto
5type
6brand
7height
8product
9outer dia 1
10 outer dia2
11inner dia1
12 inner dia 2
13unit price
NOw the client has the business of AUTO FILTERS ,means WATER SEP FILTER,OIL SEPERATOR FILTER ETC. Ror each filter they have different qualities for which they have a "Replacement No". This means if he has a Mobile of Nokia6230 he has this mobile in 3 Manufacturers and 2 pieces/Manufacturers, i.e uk made, china made, hungary made e.t.c he will assign 1 "Code No" and 3 different "Replace no" to these 3 different makes while entering the stock,now the prob is that the total number of "Replace Nos" are not fixed there can be 1 "Replace No" for 1 part and on the other hand 5 "Rep Nos " for another part ,what i am doing/trying to do is that i am using a div with a selection menu in which i want to give a serial of nos from 1 to onwards and i am using the "onchange" in the "Select" tag which is calling a javascript function which enables the other divs for eg if i have selected "3" in the "Total Replace Nos" option then it shud call the javascript function which shud enable 3 input boxes to enter the 3 replace nos for the part :( isnt it lengthy ...if there is a better way todo this thing do temme and thanks for any help in advance the code for the form is given here :
Expand|Select|Wrap|Line Numbers
  1.       <%
  2.           dim DateStatus
  3.           DateStatus=now()
  4.       %>
  5.       <tr>
  6.        <td>
  7.       <table cellspacing="0" cellpadding="0" width="690" align="center" valign="top" bordercolor="#4C4A48" height="170">
  8.       <tr><td class="add"><div align="left">Code No:</div></td>
  9.            <td width="150" align="Center" valign="Center"><div align="left"><input name="code_no" type="text" size="25" style="width:194px; height:17px; font-size:11px; font-family:tahoma; border-style:solid; border-width:1px; border-color:#4C4A48; color:#8C8B89; background-color:#0A0501 "></div></td>
  10.                   <td class="add"><div align="left">Part No:</div></td>
  11.                   <td width="150" align="Center" valign="Center"><div align="left"><input name="cust_name" type="text" size="25" style="width:194px; height:17px; font-size:11px; font-family:tahoma; border-style:solid; border-width:1px; border-color:#4C4A48; color:#8C8B89; background-color:#0A0501 "></div></td>
  12.               </tr>
  13.               <tr>           
  14.                   <td class="add"><div align="left">Total Replace No's:</div></td>
  15.                   <td class="150" align="center" valign="middle">
  16.                   <div align="left">
  17.                   <SELECT name="t_rep" onChange="" style=" width:194px; height:17px; font-size:11px; font-family:tahoma; border-style:solid; border-width:1px; border-color:#8C8B89; color:#8C8B89; background-color:#0A0501 ">
  18.                       <OPTION value="none" selected="selected">Please Select Any Number</OPTION>
  19.                       <option value="1">1</option>
  20.                       <option value="2">2</option>
  21.                       <option value="3">3</option>
  22.                       <option value="4">4</option>
  23.                   </select>
  24.                   </div>
  25.                   </td>
  26.                   <td class="add"><div align="left">Auto:</div></td>
  27.                   <td width="150" align="Center" valign="Center"><div align="left"><input name="cust_add" type="text" size="25" style="width:194px; height:17px; font-size:11px; font-family:tahoma; border-style:solid; border-width:1px; border-color:#4C4A48; color:#8C8B89; background-color:#0A0501 "></div></td>
  28.               </tr>
  29.               <tr>
  30.                   <td class="add"><div align="left">Replace No:</div></td>
  31.                   <td width="150" align="Center" valign="Center"><div align="left"><input name="cust_add" type="text" size="25" style=" width:194px; height:17px; font-size:11px; font-family:tahoma; border-style:solid; border-width:1px; border-color:#8C8B89; color:#8C8B89; background-color:#0A0501 "></div></td>
  32.                   <td class="add"><div align="left">Outer Dia1:</div></td>
  33.                   <td width="150" align="Center" valign="Center"><div align="left"><input name="toc_fr" type="text" size="25" style="width:194px; height:17px; font-size:11px; font-family:tahoma; border-style:solid; border-width:1px; border-color:#4C4A48; color:#8C8B89; background-color:#0A0501 "></div></td>
  34.               </tr>
  35.               <tr>
  36.                   <td class="add"><div align="left">Type:</div></td>
  37.                   <td width="150" align="Center" valign="Center"><div align="left"><input name="cust_add" type="text" size="25" style="width:194px; height:17px; font-size:11px; font-family:tahoma; border-style:solid; border-width:1px; border-color:#4C4A48; color:#8C8B89; background-color:#0A0501 "></div></td>
  38.                   <td class="add"><div align="left">Outer Dia2:</div></td>
  39.                   <td width="150" align="Center" valign="Center"><div align="left"><input name="toc_fr" type="text" size="25" style="width:194px; height:17px; font-size:11px; font-family:tahoma; border-style:solid; border-width:1px; border-color:#4C4A48; color:#8C8B89; background-color:#0A0501 "></div></td>
  40.               </tr>                                 
  41.               <tr>
  42.                   <td class="add"><div align="left">Brand:</div></td>
  43.                   <td ="#346598" width="150" align="Center" valign="Center"><div align="left"><input name="caller" type="text" size="25" style="width:194px; height:17px; font-size:11px; font-family:tahoma; border-style:solid; border-width:1px; border-color:#4C4A48; color:#8C8B89; background-color:#0A0501 "></div></td>
  44.                   <td class="add"><div align="left">Inner Dia1:</div></td>
  45.                   <td width="150" align="Center" valign="Center"><div align="left"><input name="toc_to" type="text" size="25" style="width:194px; height:17px; font-size:11px; font-family:tahoma; border-style:solid; border-width:1px; border-color:#4C4A48; color:#8C8B89; background-color:#0A0501 "></div></td>
  46.               </tr>
  47.               <tr>
  48.                   <td class="add"><div align="left">Height:</div></td>
  49.                   <td ="#346598" width="150" align="Center" valign="Center"><div align="left"><input name="caller" type="text" size="25" style="width:194px; height:17px; font-size:11px; font-family:tahoma; border-style:solid; border-width:1px; border-color:#4C4A48; color:#8C8B89; background-color:#0A0501 "></div></td>
  50.                   <td class="add"><div align="left">Inner Dia2:</div></td>
  51.                   <td width="150" align="Center" valign="Center"><div align="left"><input name="toc_to" type="text" size="25" style="width:194px; height:17px; font-size:11px; font-family:tahoma; border-style:solid; border-width:1px; border-color:#4C4A48; color:#8C8B89; background-color:#0A0501 "></div></td>
  52.               </tr>
  53.               <tr>
  54.                   <td class="add"><div align="left">Product:</div></td>
  55.                   <td width="150" align="Center" valign="Center"><div align="left"><input name="cust_add" type="text" size="25" style=" width:194px; height:17px; font-size:11px; font-family:tahoma; border-style:solid; border-width:1px; border-color:#8C8B89; color:#8C8B89; background-color:#0A0501 "></div></td>
  56.                   <td class="add"><div align="left">Unit Price:</div></td>
  57.                   <td width="150" align="Center"><div align="left"><input name="tel_no" type="text" size="25" style="width:194px; height:17px; font-size:11px; font-family:tahoma; border-style:solid; border-width:1px; border-color:#4C4A48; color:#8C8B89; background-color:#0A0501 "></div></td>
  58.               </tr>
  59.           </table>   
  60.           </td>
  61.       </tr>
Nov 22 '07 #1
10 1555
drhowarddrfine
7,435 Expert 4TB
This is a javascript question and I am transferring it there. However, I was tempted to delete this whole thing because I cannot take the time to try and figure out what you are saying. While I understand English may not be your primary language, your shorthand words suggest otherwise and I wouldn't be surprised if the javascript folks close this out. I suggest you edit this and make it more readable before they do.

And now I screwed up the listing for the code so you will have to repost that, too.
Nov 22 '07 #2
omerbutt
638 512MB
hi there i am working on an inventory project (platform ,HTML,JAVASCRIPT,ASP)and for that i have made a stock entry form which is pasted below,I have included this form in the main Add Stock.asp page, having the following inputs to be saved

1.code no
2.part no
3.total replace no's--------->this is wot the ques is about
4.auto
5.type
6.brand
7.height
8.product
9.outer dia 1
10. outer dia2
11.inner dia1
12.inner dia 2
13unit price

Now the client has the business of AUTO FILTERS ,now for each Filter they have different qualities for which they Reprsent a "Replacement No" means for example if he has Mobile of Nokia6230 in 3 Manufacturers andhe has 2pieces of each, i.e "uk made"=2, "china made"=2, "hungary made"=2 e.t.c he will assign 1 "Code No" the Hungary Made mobile and for the other 2 mobiles he will assign 2 "Replace Nos" in the same Entry, now the prob is that the total number of "Replace Nos" are not fixed there can be 1 "Replace No" for 1 product and on the other hand 5 "Rep Nos " for another product ,what i am doing/trying to do is that i am using a div with a selection menu in which i want to give a serial of numbers from 1 to onwards and i am using the "onchange" in the "Select" tag which is calling a javascript function which enables the other divs for eg if i have selected "3" in the "Total Replace Nos" option then it shud call the javascript function which shud enable 3 input boxes to enter the 3 replace nos for the part :( isnt it lengthy ...if there is a better way todo this thing do temme and thanks for any help in advance, the code for the form is given here :
Expand|Select|Wrap|Line Numbers
  1. <tr>
  2.  <td>
  3. <table cellspacing="0" cellpadding="0" width="690" align="center" valign="top" bordercolor="#4C4A48" height="170">
  4.  
  5. <tr><td class="add"><div align="left">Code No:</div></td>
  6.      <td width="150" align="Center" valign="Center"><div align="left"><input name="code_no" type="text" size="25" style="width:194px; height:17px; font-size:11px; font-family:tahoma; border-style:solid; border-width:1px; border-color:#4C4A48; color:#8C8B89; background-color:#0A0501 "></div></td>
  7.             <td class="add"><div align="left">Part No:</div></td>
  8.             <td width="150" align="Center" valign="Center"><div align="left"><input name="cust_name" type="text" size="25" style="width:194px; height:17px; font-size:11px; font-family:tahoma; border-style:solid; border-width:1px; border-color:#4C4A48; color:#8C8B89; background-color:#0A0501 "></div></td>
  9.         </tr>
  10.         <tr>            
  11.             <td class="add"><div align="left">Total Replace No's:</div></td>
  12.             <td class="150" align="center" valign="middle">
  13.             <div align="left">
  14.             <SELECT name="t_rep" onChange="" style=" width:194px; height:17px; font-size:11px; font-family:tahoma; border-style:solid; border-width:1px; border-color:#8C8B89; color:#8C8B89; background-color:#0A0501 ">
  15.                 <OPTION value="none" selected="selected">Please Select Any Number</OPTION>
  16.                 <option value="1">1</option>
  17.                 <option value="2">2</option>
  18.                 <option value="3">3</option>
  19.                 <option value="4">4</option>
  20.             </select>
  21.             </div>
  22.             </td>
  23.             <td class="add"><div align="left">Auto:</div></td>
  24.             <td width="150" align="Center" valign="Center"><div align="left"><input name="cust_add" type="text" size="25" style="width:194px; height:17px; font-size:11px; font-family:tahoma; border-style:solid; border-width:1px; border-color:#4C4A48; color:#8C8B89; background-color:#0A0501 "></div></td>
  25.         </tr>
  26.         <tr>
  27.             <td class="add"><div align="left">Replace No:</div></td>
  28.             <td width="150" align="Center" valign="Center"><div align="left"><input name="cust_add" type="text" size="25" style=" width:194px; height:17px; font-size:11px; font-family:tahoma; border-style:solid; border-width:1px; border-color:#8C8B89; color:#8C8B89; background-color:#0A0501 "></div></td>
  29.             <td class="add"><div align="left">Outer Dia1:</div></td>
  30.             <td width="150" align="Center" valign="Center"><div align="left"><input name="toc_fr" type="text" size="25" style="width:194px; height:17px; font-size:11px; font-family:tahoma; border-style:solid; border-width:1px; border-color:#4C4A48; color:#8C8B89; background-color:#0A0501 "></div></td>
  31.         </tr>
  32.         <tr>
  33.             <td class="add"><div align="left">Type:</div></td>
  34.             <td width="150" align="Center" valign="Center"><div align="left"><input name="cust_add" type="text" size="25" style="width:194px; height:17px; font-size:11px; font-family:tahoma; border-style:solid; border-width:1px; border-color:#4C4A48; color:#8C8B89; background-color:#0A0501 "></div></td>
  35.             <td class="add"><div align="left">Outer Dia2:</div></td>
  36.             <td width="150" align="Center" valign="Center"><div align="left"><input name="toc_fr" type="text" size="25" style="width:194px; height:17px; font-size:11px; font-family:tahoma; border-style:solid; border-width:1px; border-color:#4C4A48; color:#8C8B89; background-color:#0A0501 "></div></td>
  37.         </tr>                                            
  38.         <tr>
  39.             <td class="add"><div align="left">Brand:</div></td>
  40.             <td ="#346598" width="150" align="Center" valign="Center"><div align="left"><input name="caller" type="text" size="25" style="width:194px; height:17px; font-size:11px; font-family:tahoma; border-style:solid; border-width:1px; border-color:#4C4A48; color:#8C8B89; background-color:#0A0501 "></div></td>
  41.             <td class="add"><div align="left">Inner Dia1:</div></td>
  42.             <td width="150" align="Center" valign="Center"><div align="left"><input name="toc_to" type="text" size="25" style="width:194px; height:17px; font-size:11px; font-family:tahoma; border-style:solid; border-width:1px; border-color:#4C4A48; color:#8C8B89; background-color:#0A0501 "></div></td>
  43.         </tr>
  44.         <tr>
  45.             <td class="add"><div align="left">Height:</div></td>
  46.             <td ="#346598" width="150" align="Center" valign="Center"><div align="left"><input name="caller" type="text" size="25" style="width:194px; height:17px; font-size:11px; font-family:tahoma; border-style:solid; border-width:1px; border-color:#4C4A48; color:#8C8B89; background-color:#0A0501 "></div></td>
  47.             <td class="add"><div align="left">Inner Dia2:</div></td>
  48.             <td width="150" align="Center" valign="Center"><div align="left"><input name="toc_to" type="text" size="25" style="width:194px; height:17px; font-size:11px; font-family:tahoma; border-style:solid; border-width:1px; border-color:#4C4A48; color:#8C8B89; background-color:#0A0501 "></div></td>
  49.         </tr>
  50.         <tr>
  51.             <td class="add"><div align="left">Product:</div></td>
  52.             <td width="150" align="Center" valign="Center"><div align="left"><input name="cust_add" type="text" size="25" style=" width:194px; height:17px; font-size:11px; font-family:tahoma; border-style:solid; border-width:1px; border-color:#8C8B89; color:#8C8B89; background-color:#0A0501 "></div></td>
  53.             <td class="add"><div align="left">Unit Price:</div></td>
  54.             <td width="150" align="Center"><div align="left"><input name="tel_no" type="text" size="25" style="width:194px; height:17px; font-size:11px; font-family:tahoma; border-style:solid; border-width:1px; border-color:#4C4A48; color:#8C8B89; background-color:#0A0501 "></div></td>
  55.         </tr>
  56.     </table>    
  57.     </td>
  58. </tr>
  59.  
  60.  
Nov 22 '07 #3
acoder
16,027 Expert Mod 8TB
You're not calling any function onchange.

Where's the JavaScript code or have you not written any yet?

Could you explain a little more what exactly needs adding?
Nov 22 '07 #4
acoder
16,027 Expert Mod 8TB
I've merged the two threads - your thread was already moved here.
Nov 22 '07 #5
omerbutt
638 512MB
You're not calling any function onchange.

Where's the JavaScript code or have you not written any yet?

Could you explain a little more what exactly needs adding?

okay,................i am rewriting the code and have just inclued the part in which i need the help okay below isteh code u can copy paste and run ........what this code has is it has a Dropdown Selection Box with a name of
"TOTAL REP NOS"in which we have 2 options
namely "1 replace no", "2 replace nos"
if we select "1 replace no" then it will enable the div named "rep_no_1"
and if we select "2 replace nos" then it will enable div named "rep_no_2" along with the "rep_no_1" ,,,,,,.............now in this code the selection box has only 2 options i want those options to be unlimited means like this
{1 rep no ,2 rep no,3 rep nos and so on}.....means it shud not be hard coded

NO 2

it shud generate the input boxes according to the selected option in the
"Total rep nos".......what i have done is i have created those 2 input boxes named as "rep no 1" & "rep no 2" and have hidden it through a javascript funtion named "HideDiv()" , which i am calling in the<body onload="Hidediv();"> which uses an 'inline' code and hides those input fields ........whereas i donot want to do this because the client can have any number of "Rep nos" ....i hope u get the rest when ou will see and run the code ,,,,,,,,,,,,,,,,thanks in advance 4 any help
Expand|Select|Wrap|Line Numbers
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4.     <title>Add New Stock</title>
  5. <link rel="stylesheet" href="home.css" />
  6. <link rel="stylesheet" type="text/css" href="cssverticalmenu.css" />
  7. <link rel="stylesheet" type="text/css" href="Stk_frm.css" />
  8. <script type="text/javascript" language="javascript">
  9.         function HideDiv()
  10.         {
  11.             eval("document.all.lable_rep_no1.style.display = 'none';");
  12.             eval("document.all.div_rep_no1.style.display = 'none';");
  13.             eval("document.all.lable_rep_no2.style.display = 'none';");
  14.             eval("document.all.div_rep_no2.style.display = 'none';");            
  15.         }
  16.         function enablediv()
  17.         {
  18.             if((document.all.t_rep.value)=="a")
  19.             {
  20.                 HideDiv();
  21.                 eval("document.all.lable_rep_no1.style.display = 'inline';");
  22.                 eval("document.all.div_rep_no1.style.display = 'inline';");                
  23.             }
  24.             else if((document.all.t_rep.value)=="b")
  25.             {
  26.                 HideDiv();
  27.                 eval("document.all.lable_rep_no1.style.display = 'inline';");
  28.                 eval("document.all.div_rep_no1.style.display = 'inline';");    
  29.                 eval("document.all.lable_rep_no2.style.display = 'inline';");
  30.                 eval("document.all.div_rep_no2.style.display = 'inline';");
  31.             }
  32.             else
  33.             {
  34.                 HideDiv();
  35.             }
  36.         }
  37. </script>
  38. </head>
  39. <body bgcolor="#1D1710" onload="HideDiv(); document.stkfrm.code_no.focus();">
  40. <form name="stkfrm" method="post">
  41. <table width="100%">
  42. <div class="content" align="center">
  43.     <div id="top">    
  44.         <h1>FILTERS INVENTORY SYSTEM</h1>
  45.         <h2>STOCK ENTRY FORM</h2>
  46.     </div>
  47. </div>
  48.  
  49. <table align="left" cellpadding="0" cellspacing="0" width="190" bgcolor="#0A0501">
  50. </table>    
  51.     <tr>
  52. <tr>
  53.     <div class="h1" align="left">
  54.         <div id="top2" align="left">
  55.             <h3>Add New Stock Item</h3>
  56.         </div>
  57.     </div>
  58. </tr>
  59. <tr>
  60. <td>
  61. <table align="center" cellpadding="0" cellspacing="0" width="700" bgcolor="#0A0501" bordercolor="4C4A48">
  62.     <tr>
  63.         <td><br>
  64.             <tr>            
  65.             <td class="add"><div align="left"><font face="Verdana, Arial, Helvetica, sans-serif" color="#FFFFFF">Total Replace No's:</font></div></td>
  66.             <td class="150" align="center" valign="middle">
  67.             <div align="left">
  68.             <SELECT name="t_rep" onChange="enablediv();" style=" width:194px; height:17px; font-size:11px; font-family:tahoma; border-style:solid; border-width:1px; border-color:#8C8B89; color:#8C8B89; background-color:#0A0501 ">
  69.                 <OPTION value="none" selected="selected">Please Select Any Number</OPTION>
  70.                 <option value="a">1 Rep No</option>
  71.                 <option value="b">2 Rep Nos</option>
  72.             </select>
  73.             </div>
  74.             </td>
  75.         </tr>
  76.         <tr>
  77.             <td class="add"><div align="left" id="lable_rep_no1"><font face="Verdana, Arial, Helvetica, sans-serif" color="#FFFFFF">Rep no1:</font></div></td>
  78.             <td width="150" align="Center" valign="Center"><div align="left" id="div_rep_no1"><input name="rep_no1" type="text" size="25" style="width:194px; height:17px; font-size:11px; font-family:tahoma; border-style:solid; border-width:1px; border-color:#4C4A48; color:#8C8B89; background-color:#0A0501 "></div></td>
  79.         </tr>
  80.         <tr>
  81.             <td class="add"><div align="left" id="lable_rep_no2"><font face="Verdana, Arial, Helvetica, sans-serif" color="#FFFFFF">Rep no2:</font></div></td>
  82.             <td width="150" align="Center" valign="Center"><div align="left" id="div_rep_no2"><input name="rep_no2" type="text" size="25" style="width:194px; height:17px; font-size:11px; font-family:tahoma; border-style:solid; border-width:1px; border-color:#4C4A48; color:#8C8B89; background-color:#0A0501 "></div></td>
  83.         </tr>
  84.             </td>
  85.         </tr>
  86.     </tr>
  87.     <tr>
  88.     <td>
  89.  
  90.     </td>
  91.     </tr>
  92.     <tr>
  93.     <td>
  94.     <table align="right" cellpadding="0" cellspacing="0" width="50%" border="1" bordercolor="#0A0501">
  95.         <td align="center" ><input name="" type="image" src="images/submit.jpg" align="absmiddle" style="margin-left:80px" onclick="javascript:return val_log();"></td>
  96.         <td align="left" ><input name="" type="image" src="images/reset.jpg" align="absmiddle" style="margin-left:0px" onclick="javascript:return canc();"></td>
  97.      </table>
  98.     </td>
  99.     </tr>
  100.     <tr>
  101.     <td>
  102.  
  103.     </td>
  104.     </tr>
  105. </table>
  106. </td>
  107. </tr>
  108.     </tr>
  109. </table>
  110. </form>
  111. </body>
  112. </html>
  113.  
Nov 22 '07 #6
acoder
16,027 Expert Mod 8TB
When you say you don't want it hard-coded, how are you going to decide how many? Is this determined from the server-side code?

Note 1: don't use document.all. Use document.getElementById instead - you will need to give your elements ids.

Note 2: there's no need to use eval. Remove eval and the JavaScript statements should be executed.
Nov 22 '07 #7
omerbutt
638 512MB
When you say you don't want it hard-coded, how are you going to decide how many? Is this determined from the server-side code?

Note 1: don't use document.all. Use document.getElementById instead - you will need to give your elements ids.

Note 2: there's no need to use eval. Remove eval and the JavaScript statements should be executed.
that isw the problem i t could be any number that the user decides can be 4 replace no for a product and can be 1 replace number :( i am rally stucked in it
..........sir if u have any other way to do this lemme know and i am a new bee to javascript i am not that much expert at it and i havent used that document.getElementById....can u give me some helping code or ereeference through which i can have an idea that what i have to do
Nov 22 '07 #8
acoder
16,027 Expert Mod 8TB
that isw the problem i t could be any number that the user decides can be 4 replace no for a product and can be 1 replace number :( i am rally stucked in it
..........sir if u have any other way to do this lemme know and i am a new bee to javascript i am not that much expert at it and i havent used that document.getElementById....can u give me some helping code or ereeference through which i can have an idea that what i have to do
You will have to dynamically create elements or, if you have a maximum, you could hide them all and display the ones required.

What if someone wants more than the number you have in the select element? You would need to let them enter a number in a text field and then parse it to get the number and display that number of divs/input text boxes.

For document.getElementById(), see this link.
Nov 22 '07 #9
omerbutt
638 512MB
hi i am trying to make an input box that shud take a numeric input and then display that number of input boxes under it,for e.g a user enters 4 in the input box then there should be 4 input boxes appearing under it, what i have done in my code is here, my current code is for 2 input boxes but it is not working
Expand|Select|Wrap|Line Numbers
  1. <html>
  2. <head>
  3. <script type="javascript">
  4. function HideDiv()
  5. {
  6.     eval("document.all.lable_rep_no1.style.display = 'none';");
  7.     eval("document.all.div_rep_no1.style.display = 'none';");
  8.     eval("document.all.lable_rep_no2.style.display = 'none';");
  9.     eval("document.all.div_rep_no2.style.display = 'none';");        
  10. }
  11.  
  12. function enablediv()
  13. {
  14.     var Count;
  15.     Count = document.getElementById('t_rep');
  16.     if((Count)=="1")
  17.     {
  18.     HideDiv();
  19.     eval("document.all.lable_rep_no1.style.display = 'inline';");
  20.     eval("document.all.div_rep_no1.style.display = 'inline';");
  21.     }
  22.     else if((Count)=="2")
  23.     {
  24.     HideDiv();
  25.     eval("document.all.lable_rep_no1.style.display = 'inline';");
  26.     eval("document.all.div_rep_no1.style.display = 'inline';");    
  27.     eval("document.all.lable_rep_no2.style.display = 'inline';");
  28.     eval("document.all.div_rep_no2.style.display = 'inline';");
  29.     }
  30.     else
  31.     {
  32.     HideDiv();
  33.     }
  34. }
  35. </script>
  36. </head>
  37. <body bgcolor="#1D1710" onload="HideDiv(); document.stkfrm.t_rep.focus();">
  38. <form name="stkfrm" method="post">
  39. <table width="100%">
  40. <div class="content" align="center">
  41.     <div id="top">    
  42.         <h1>FILTERS INVENTORY SYSTEM</h1>
  43.         <h2>STOCK ENTRY FORM</h2>
  44.     </div>
  45. </div>
  46.  
  47. <table align="left" cellpadding="0" cellspacing="0" width="190" bgcolor="#0A0501">
  48. </table>    
  49.     <tr>
  50. <tr>
  51.     <div class="h1" align="left">
  52.         <div id="top2" align="left">
  53.             <h3>Add New Stock Item</h3>
  54.         </div>
  55.     </div>
  56. </tr>
  57.  
  58. <table align="center" cellpadding="0" cellspacing="0" width="700" bgcolor="#0A0501" bordercolor="4C4A48">
  59. <tr>
  60.     <td>
  61.         <tr>            
  62.             <td class="add"><div align="left"><font face="Verdana, Arial, Helvetica, sans-serif" color="#FFFFFF">Total Replace No's:</font></div></td>
  63.             <td class="150" align="center" valign="middle"><div align="left"><input onkeypress="enablediv();" id="t_rep" type="text" style=" width:194px; height:17px; font-size:11px; font-family:tahoma; border-style:solid; border-width:1px; border-color:#8C8B89; color:#8C8B89; background-color:#0A0501 "></div>
  64.             </td>
  65.         </tr>
  66.         <tr>
  67.             <td class="add"><div align="left" id="lable_rep_no1"><font face="Verdana, Arial, Helvetica, sans-serif" color="#FFFFFF">Rep no1:</font></div></td>
  68.             <td width="150" align="Center" valign="Center"><div align="left" id="div_rep_no1"><input name="rep_no1" type="text" size="25" style="width:194px; height:17px; font-size:11px; font-family:tahoma; border-style:solid; border-width:1px; border-color:#4C4A48; color:#8C8B89; background-color:#0A0501 "></div></td>
  69.         </tr>
  70.         <tr>
  71.             <td class="add"><div align="left" id="lable_rep_no2"><font face="Verdana, Arial, Helvetica, sans-serif" color="#FFFFFF">Rep no2:</font></div></td>
  72.             <td width="150" align="Center" valign="Center"><div align="left" id="div_rep_no2"><input name="rep_no2" type="text" size="25" style="width:194px; height:17px; font-size:11px; font-family:tahoma; border-style:solid; border-width:1px; border-color:#4C4A48; color:#8C8B89; background-color:#0A0501 "></div></td>
  73.         </tr>
  74.     </td>
  75. <tr>
  76.     <td>
  77.     <table align="right" cellpadding="0" cellspacing="0" width="50%" border="1" bordercolor="#0A0501">
  78.         <td align="center" ><input name="" type="image" src="images/submit.jpg" align="absmiddle" style="margin-left:80px" onclick=""></td>
  79.         <td align="left" ><input name="" type="image" src="images/reset.jpg" align="absmiddle" style="margin-left:0px" onclick=""></td>
  80.      </table>
  81.     </td>
  82.     </tr>
  83.     <tr>
  84.     <td>
  85.  
  86.     </td>
  87.     </tr>
  88. </table>
  89. </td>
  90. </tr>
  91.     </tr>
  92. </table>
  93. </form>
  94. </body>
  95. </html>
  96.  
Nov 23 '07 #10
acoder
16,027 Expert Mod 8TB
I've merged this with your previous thread - keep this problem to one thread.

You will need to dynamically create the input boxes using document.createElement().
Nov 23 '07 #11

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

3 posts views Thread by Lozette | last post: by
5 posts views Thread by Nathan Bloom | last post: by
5 posts views Thread by kildareguy | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.