hi tere i have a page in which i have the requirement that the client has 2 select (Length,Weight) and 1 text(Quantity) inputs and 2 buttons (add and remove) the idea is that the client should enter some number in the quantity field and hit the add button and he could add another row with the same fields and then he could again enter the quantity and so on , i have done all this successfully ,in FF when i add row another row appears under it and then another and so on but the problem is in IE it do adds a new row but the height of the div does not increase accordingly it shows only the first two div and how many rows i may add it wont give me any error but does not show me even anything atall
i am posting my code here and a working sample http://www.myrage.biz/custom_order.php
the HTML CODE
[code=html]
<input type="hidden" name="rows_t" id="rows_t" value="1" /><input type="hidden" name="myid" id="myid" value="<?=$myid ;?>" />
<table cellspacing="0" cellpadding="0" align="left" width="400" border="0">
<tr><td class="tdheight _11"></td></tr>
<tr>
<td align="left" valign="top" width="400">
<div id="specs_1">
<table cellspacing="0" cellpadding="0" align="center" width="400" border="0">
<tr>
<td align="left" valign="middle" class="text_gre y_12_b_b" width="125">Len gth:<br />
<span>
<select name="prod_leng th_1" id="prod_length _1" class="text_gre y_12_b_b" style="width:10 0px;">
<option value="36.5">36 .5"</option>
<option value="37">37"</option>
<option value="37.5">37 .5"</option>
<option value="37">38"</option>
</select>
</span>
</td>
<td> </td>
<td align="left" valign="middle" class="text_gre y_12_b_b" width="125">Wei ght:<br />
<span>
<select name="prod_weig ht_1" id="prod_weight _1" class="text_gre y_12_b_b" style="width:10 0px;">
<option value="Light">L ight</option>
<option value="Medium"> Medium</option>
<option value="Heavy">H eavy</option>
</select>
</span>
</td>
<td> </td>
<td align="left" valign="middle" class="text_gre y_12_b_b" width="125">Qua ntity:<br /><span><input type="text" name="prod_qty_ 1" id="prod_qty_1 " value="" class="textfiel d_reg_grey" style="width:50 px; height:15px;" /></span></td>
<td> </td>
<td align="left" valign="bottom" class="text_gre y_12_b" width="125">
<span id="adder_1" style="display: inline;"><input type="button" name="addrow_1" id="addrow_1" value="Add Row" onclick="AddRow ('1');" class="add" style="border:0 px; cursor:pointer; " /></span>
<div id="deller_1" style="display: none;"><input type="button" name="delrow_1" id="delrow_1" value="" onclick="DelRow ('1');" class="delete" style="border:0 px; cursor:pointer; " /></div>
</td>
</tr>
</table>
</div>
</td>
</tr>
<tr><td align="left" valign="middle" width="925" colspan="2"><di v id="specs_div"> </div></td></tr>
<tr><td class="tdheight _11"></td></tr>
</table>
[/code]
THE Javascript
[code=javascript]
function AddRow(row){
if(document.get ElementById("pr od_qty_"+row).v alue!=""){
if(chkNumeric(d ocument.getElem entById("prod_q ty_"+row).value )){
ObjxmlAdd=GetXm lHttpObject();
if(ObjxmlAdd==n ull){
alert("You need to upgrade your Browser");
return;
}else{
ObjxmlAdd.onrea dystatechange=$ row_;
ObjxmlAdd.open( "GET","ajax/custom_addrow.p hp?specid="+Mat h.random()+"&ro w="+row,true) ;
ObjxmlAdd.send( null);
document.getEle mentById("adder _"+row).style.d isplay='none';
document.getEle mentById("delle r_"+row).style. display='inline ';
}
}else{
msg_divs('error ','300px','280p x','400px','400 px',"<strong>Yo u must enter a ''Numeric'' value for ''Quantity''</strong>");
}
}else{
msg_divs('error ','300px','280p x','400px','400 px',"<strong>Yo u must enter ''Quantity''</strong>");
return;
}
}
function chkNumeric(str) {// check for valid numeric strings
var strValidChars = "0123456789 ";
var strChar;
var blnResult = true;
if (str.length == 0){
return false;
}
for (i = 0; i < str.length && blnResult == true; i++){// test strString consists of valid characters listed above
strChar = str.charAt(i);
if (strValidChars. indexOf(strChar ) == -1){
blnResult = false;
}
}
return blnResult;
}
function $row_(){
if(ObjxmlAdd.re adyState==4){
if(ObjxmlAdd.st atus==200){
var ni = document.getEle mentById('specs _div');
var numi = document.getEle mentById('rows_ t');
var num = (document.getEl ementById('rows _t').value -1)+ 2;
numi.value = num;
var resdiv = document.create Element('div');
var divIdName = 'specs_'+num;
resdiv.setAttri bute('id',divId Name);
resdiv.innerHTM L = ObjxmlAdd.respo nseText;
ni.appendChild( resdiv);
}
}
}
function DelRow(row){
if(row==1){
document.getEle mentById("specs _1").innerHTML= "";
}else{
var d = document.getEle mentById('specs _div');
var divname ='specs_'+row;
var olddiv =document.getEl ementById(divna me);
d.removeChild(o lddiv);
}
var rows_left=parse Int(document.ge tElementById("r ows_t").value);
rows_left=rows_ left-1;
document.getEle mentById("rows_ t").value=rows_ left;
}
[/code]
thanks for any help in advance,
Ragards,
Omer Aslam
i am posting my code here and a working sample http://www.myrage.biz/custom_order.php
the HTML CODE
[code=html]
<input type="hidden" name="rows_t" id="rows_t" value="1" /><input type="hidden" name="myid" id="myid" value="<?=$myid ;?>" />
<table cellspacing="0" cellpadding="0" align="left" width="400" border="0">
<tr><td class="tdheight _11"></td></tr>
<tr>
<td align="left" valign="top" width="400">
<div id="specs_1">
<table cellspacing="0" cellpadding="0" align="center" width="400" border="0">
<tr>
<td align="left" valign="middle" class="text_gre y_12_b_b" width="125">Len gth:<br />
<span>
<select name="prod_leng th_1" id="prod_length _1" class="text_gre y_12_b_b" style="width:10 0px;">
<option value="36.5">36 .5"</option>
<option value="37">37"</option>
<option value="37.5">37 .5"</option>
<option value="37">38"</option>
</select>
</span>
</td>
<td> </td>
<td align="left" valign="middle" class="text_gre y_12_b_b" width="125">Wei ght:<br />
<span>
<select name="prod_weig ht_1" id="prod_weight _1" class="text_gre y_12_b_b" style="width:10 0px;">
<option value="Light">L ight</option>
<option value="Medium"> Medium</option>
<option value="Heavy">H eavy</option>
</select>
</span>
</td>
<td> </td>
<td align="left" valign="middle" class="text_gre y_12_b_b" width="125">Qua ntity:<br /><span><input type="text" name="prod_qty_ 1" id="prod_qty_1 " value="" class="textfiel d_reg_grey" style="width:50 px; height:15px;" /></span></td>
<td> </td>
<td align="left" valign="bottom" class="text_gre y_12_b" width="125">
<span id="adder_1" style="display: inline;"><input type="button" name="addrow_1" id="addrow_1" value="Add Row" onclick="AddRow ('1');" class="add" style="border:0 px; cursor:pointer; " /></span>
<div id="deller_1" style="display: none;"><input type="button" name="delrow_1" id="delrow_1" value="" onclick="DelRow ('1');" class="delete" style="border:0 px; cursor:pointer; " /></div>
</td>
</tr>
</table>
</div>
</td>
</tr>
<tr><td align="left" valign="middle" width="925" colspan="2"><di v id="specs_div"> </div></td></tr>
<tr><td class="tdheight _11"></td></tr>
</table>
[/code]
THE Javascript
[code=javascript]
function AddRow(row){
if(document.get ElementById("pr od_qty_"+row).v alue!=""){
if(chkNumeric(d ocument.getElem entById("prod_q ty_"+row).value )){
ObjxmlAdd=GetXm lHttpObject();
if(ObjxmlAdd==n ull){
alert("You need to upgrade your Browser");
return;
}else{
ObjxmlAdd.onrea dystatechange=$ row_;
ObjxmlAdd.open( "GET","ajax/custom_addrow.p hp?specid="+Mat h.random()+"&ro w="+row,true) ;
ObjxmlAdd.send( null);
document.getEle mentById("adder _"+row).style.d isplay='none';
document.getEle mentById("delle r_"+row).style. display='inline ';
}
}else{
msg_divs('error ','300px','280p x','400px','400 px',"<strong>Yo u must enter a ''Numeric'' value for ''Quantity''</strong>");
}
}else{
msg_divs('error ','300px','280p x','400px','400 px',"<strong>Yo u must enter ''Quantity''</strong>");
return;
}
}
function chkNumeric(str) {// check for valid numeric strings
var strValidChars = "0123456789 ";
var strChar;
var blnResult = true;
if (str.length == 0){
return false;
}
for (i = 0; i < str.length && blnResult == true; i++){// test strString consists of valid characters listed above
strChar = str.charAt(i);
if (strValidChars. indexOf(strChar ) == -1){
blnResult = false;
}
}
return blnResult;
}
function $row_(){
if(ObjxmlAdd.re adyState==4){
if(ObjxmlAdd.st atus==200){
var ni = document.getEle mentById('specs _div');
var numi = document.getEle mentById('rows_ t');
var num = (document.getEl ementById('rows _t').value -1)+ 2;
numi.value = num;
var resdiv = document.create Element('div');
var divIdName = 'specs_'+num;
resdiv.setAttri bute('id',divId Name);
resdiv.innerHTM L = ObjxmlAdd.respo nseText;
ni.appendChild( resdiv);
}
}
}
function DelRow(row){
if(row==1){
document.getEle mentById("specs _1").innerHTML= "";
}else{
var d = document.getEle mentById('specs _div');
var divname ='specs_'+row;
var olddiv =document.getEl ementById(divna me);
d.removeChild(o lddiv);
}
var rows_left=parse Int(document.ge tElementById("r ows_t").value);
rows_left=rows_ left-1;
document.getEle mentById("rows_ t").value=rows_ left;
}
[/code]
thanks for any help in advance,
Ragards,
Omer Aslam
Comment