Click here to Skip to main content
15,888,600 members
Home / Discussions / Web Development
   

Web Development

 
GeneralRe: How To Make a hyperlink using Javascript.......? Pin
Christian Graus7-Apr-08 12:29
protectorChristian Graus7-Apr-08 12:29 
AnswerRe: How To Make a hyperlink using Javascript.......? Pin
Sachin Pimpale6-Apr-08 21:36
Sachin Pimpale6-Apr-08 21:36 
GeneralFill area Image Map Help me soon Pin
Member 12583735-Apr-08 17:53
Member 12583735-Apr-08 17:53 
GeneralPosition of table differs in different browsers [modified] Pin
ASPnoob4-Apr-08 21:33
ASPnoob4-Apr-08 21:33 
GeneralRe: Position of table differs in different browsers Pin
User 98854-Apr-08 23:16
User 98854-Apr-08 23:16 
QuestionBrowser icon in address bar? Pin
Revathij4-Apr-08 21:12
Revathij4-Apr-08 21:12 
GeneralRe: Browser icon in address bar? Pin
Johnny ²4-Apr-08 21:33
Johnny ²4-Apr-08 21:33 
QuestioninnerHTML - unknown runtime error. Pin
Kiran S. S.3-Apr-08 23:41
Kiran S. S.3-Apr-08 23:41 
I want add a row to the table dynamically using JavaScript code. In one my application it works fine. But in this application it is prompting error to IE 'unknown runtime error.'.

I have use css style sheet in this project. I am not able to find the exact cause and solution of problem.

This is an classic asp. I request you all to please help me out to find the solution.

I am provide original code of the page:
-----------------------------------------------------------------------
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<!--#include virtual="dsp/include/includedb.asp"-->
<!--#include virtual="dsp/include/checkLogin.asp"-->
<%
dim rsItem, strSql, strItem
set rsItem = Server.CreateObject("ADODB.RecordSet")
strSql = "SELECT * FROM iteam_MSt WHERE status=true;"
rsItem.Open strSql, con, 1, 3
do until rsItem.EOF
strItem = strItem & "<option value='" & rsItem.Fields("iteam_ID") & "-" & rsItem.Fields("price") &"-" & rsItem.Fields("iteam_Code") &"'>" & rsItem.Fields("details") & "</option>" & vbCrLf
rsItem.MoveNext
loop
rsItem.Close
set rsItem = nothing
con.close
set con = nothing
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>New Purchase</title>
<link href="../include/dsp.css" rel="stylesheet" type="text/css" />
<script type="text/javascript">
var ct = 1;
function CmdAdd_onclick() {
var newTable,startTag,endTag;
newTable = "";
startTag = "";
endTag = "";
var trContents0, trContents1, trContents2, trContents3, trContents4, trContents5, trContents6;
ct = ct + 1;

//Creating a new table
startTag+= "<table width='100%' border='0' cellspacing='0' cellpadding='2'>"
startTag+="<tr>"
startTag+="<td width='2%'>No</td>"
startTag+="<td width='28%'>Product Name</td>"
startTag+="<td width='17%'>Product Code</td>"
startTag+="<td width='10%'>Price</td>"
startTag+="<td width='15%'>Quantity</td>"
startTag+="<td colspan='2'>Total Amount</td>"
startTag+="</tr>"
startTag+="<tr>"
startTag+="<td colspan='7'></td>"
startTag+="</tr>"

endTag = "<tr><td colspan='7'></td></tr>"
endTag +="<tr><td colspan='5'><div align='right'>Grand Total</div></td><td colspan='2'><input name='txtGrndTotal' type='text' id='txtGrndTotal' style='font-size:12px; border:0px;' value='' size='20' readonly='readonly' /></td></tr>"
endTag +="<tr><td colspan='7'></td></tr>"
endTag +="<tr><td colspan='7'><input type='submit' name='Submit' value='Create Final Bill' /></td></tr></table>"


newTable=startTag;

var opt;

//Get the row contents
trContents0=document.getElementsByName('txtno');
trContents1=document.getElementsByName('cmbProduct');
trContents2=document.getElementsByName('txtCode');
trContents3=document.getElementsByName('txtPrice');
trContents4=document.getElementsByName('txtQty');
trContents5=document.getElementsByName('txtTotAmnt');
//trContents6=document.getElementsByName('txtGrndTotal');
//opt=document.getElementById('LstProdNo');

if(trContents1.length > 0)
{
for(i=0;i<trContents1.length;i++)
{
if(trContents1(i).innerHTML)
{
// newTable+="<TR><TD style=\"WIDTH: 120px\" ><input name=\"txtno\" type=\"text\" readonly=\"readonly\" size=\"5\" value='" + trContents0(i).value + "'/>" +"</TD>";
// newTable+="<TD style=\"WIDTH: 120px\" ><select name=\"LstProdNo\" id=\"userid\">" + trContents1(i).innerHTML + "</select>" +"</TD>";
// newTable+="<TD style=\"WIDTH: 120px\" ><input name=\"TxtQty\" type=\"text\" id=\"username\" value='" + trContents2(i).value + "'/>" +"</TD>";
// newTable+="<TD style=\"WIDTH: 120px\" ><input name=\"TxtPrice\" type=\"text\" id=\"department\" value='" + trContents3(i).value + "'/>" +"</TD><TR>";
newTable+="<tr>"
newTable+="<td><input name=\"txtNo\" type=\"text\" id=\"txtNo\" style=\"font-size:12px; border:0px;\" size=\"4\" readonly=\"readonly\" value='" + trContents0(i).value + "'/></td>"
newTable+="<td><select name=\"cmbProduct\" id=\"cmbProduct\" style=\"font-size:12px;\">" + trContents1(i).innerHTML + "</select></td>"
newTable+="<td><input name=\"txtCode\" type=\"text\" id=\"txtCode\" style=\"font-size:12px; border:0px;\" readonly=\"readonly\" value='" + trContents2(i).value + "' /></td>"
newTable+="<td><input name=\"txtPrice\" type=\"text\" id=\"txtPrice\" style=\"font-size:12px; border:0px;\" size=\"5\" readonly=\"readonly\" value='" + trContents3(i).value + "' /></td>"
newTable+="<td><input name=\"txtQty\" type=\"text\" id=\"txtAmnt\" style=\"font-size:12px;\" size=\"5\" value='" + trContents4(i).value + "' /></td>"
newTable+="<td width=\"19%\"><input name=\"txtTotAmnt\" type=\"text\" id=\"txtTotAmnt\" style=\"font-size:12px; border:0px;\" size=\"10\" readonly=\"readonly\" value='" + trContents5(i).value + "'/></td>"
newTable+="<td width=\"9%\">&nbsp;</td>"
newTable+="</tr>"
}
}
}



//Add the Latest row
/*newTable+="<TR><TD style=\"WIDTH: 120px\" ><input name=\"txtno\" type=\"text\" readonly=\"readonly\" size=\"5\" value='" + ct + "'/>" +"</TD>";
newTable+="<TD style=\"WIDTH: 120px\" ><select name=\"LstProdNo\" id=\"userid\">" + opt.innerHTML + "</select>" +"</TD>";
newTable+="<TD style=\"WIDTH: 120px\" ><input name=\"TxtQty\" type=\"text\" id=\"username\" value=\"0\" />" +"</TD>";
newTable+="<TD style=\"WIDTH: 120px\" ><input name=\"TxtPrice\" type=\"text\" id=\"department\" value=\"0\"/>" +"</TD><TR>";*/
newTable+="<tr>"
newTable+="<td><input name=\"txtNo\" type=\"text\" id=\"txtNo\" style=\"font-size:12px; border:0px;\" size=\"4\" readonly=\"readonly\" value='" + ct + "'></td>"
newTable+="<td><select name=\"cmbProduct\" id=\"cmbProduct\" style=\"font-size:12px;\">" + trContents1(0).innerHTML + "</select></td>"
newTable+="<td><input name=\"txtCode\" type=\"text\" id=\"txtCode\" style=\"font-size:12px; border:0px;\" readonly=\"readonly\" /></td>"
newTable+="<td><input name=\"txtPrice\" type=\"text\" id=\"txtPrice\" style=\"font-size:12px; border:0px;\" size=\"5\" readonly=\"readonly\" /></td>"
newTable+="<td><input name=\"txtQty\" type=\"text\" id=\"txtAmnt\" style=\"font-size:12px;\" size=\"5\" /></td>"
newTable+="<td width=\"19%\"><input name=\"txtTotAmnt\" type=\"text\" id=\"txtTotAmnt\" style=\"font-size:12px; border:0px;\" size=\"10\" readonly=\"readonly\" /></td>"
newTable+="<td width=\"9%\"><input type=\"button\" name=\"Button\" value=\"ADD Product\" onclick=\"CmdAdd_onclick();\"/></td>"
newTable+="</tr>"
newTable+=endTag;

//Update the Previous Table With New Table.
document.getElementById('mainTbl').insertAdjacentHTML;
document.getElementById('mainTbl').innerHTML=newTable;


}
</script>
</head>

<body>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="40" class="Head1">Buy Products</td>
</tr>
<tr>
<td class="smlTbLine1"></td>
</tr>
<tr>
<td><form id="form1" name="form1" method="post" action="">
<table width="100%" border="0" cellpadding="2" cellspacing="0" id="mainTbl">
<tr>
<td width="2%" class="reportHead3">No</td>
<td width="28%" class="reportHead3">Product Name </td>
<td width="17%" class="reportHead3">Product Code </td>
<td width="10%" class="reportHead3">Price</td>
<td width="15%" class="reportHead3">Quantity</td>
<td colspan="2" class="reportHead3">Total Amount </td>
</tr>
<tr>
<td colspan="7" class="smlTbLine"></td>
</tr>

<tr>
<td><input name="txtNo" type="text" id="txtNo" style="font-size:12px; border:0px;" value="1" size="4" readonly="readonly"/></td>
<td><select name="cmbProduct" id="cmbProduct" style="font-size:12px;">
<%=strItem%>
</select> </td>
<td><input name="txtCode" type="text" id="txtCode" style="font-size:12px; border:0px;" readonly="readonly" /></td>
<td><input name="txtPrice" type="text" id="txtPrice" style="font-size:12px; border:0px;" value="1" size="5" readonly="readonly" /></td>
<td><input name="txtQty" type="text" id="txtQty" style="font-size:12px;" size="5" /></td>
<td width="19%"><input name="txtTotAmnt" type="text" id="txtTotAmnt" style="font-size:12px; border:0px;" size="10" readonly="readonly" /></td>
<td width="9%"><input type="button" name="Button" value="ADD Product" onclick="CmdAdd_onclick();"/></td>
</tr>
<tr>
<td colspan="7" class="smlTbLine"></td>
</tr>
<tr>
<td colspan="5" class="reportHead3"><div align="right">Grand Total </div></td>
<td colspan="2"><input name="txtGrndTotal" type="text" id="txtGrndTotal" style="font-size:12px; border:0px;" value="" size="20" readonly="readonly" /></td>
</tr>
<tr>
<td colspan="7" class="smlTbLine"></td>
</tr>
<tr>
<td colspan="7"><input type="submit" name="Submit" value="Create Final Bill" /></td>
</tr>
</table>
</form>
</td>
</tr>
<tr>
<td class="smlTbLine1"></td>
</tr>
</table>
</body>
</html>

Kiran Sajanikar
Software Engineer
Pune.
GeneralRe: innerHTML - unknown runtime error. Pin
Shog94-Apr-08 5:45
sitebuilderShog94-Apr-08 5:45 
GeneralRe: innerHTML - unknown runtime error. Pin
User 98854-Apr-08 18:04
User 98854-Apr-08 18:04 
GeneralRe: innerHTML - unknown runtime error. Pin
Soumini Ramakrishnan8-Apr-08 0:33
Soumini Ramakrishnan8-Apr-08 0:33 
QuestionShow dialog Upload in Firefox. Pin
ThienK273-Apr-08 20:26
ThienK273-Apr-08 20:26 
GeneralRe: Show dialog Upload in Firefox. Pin
Shog94-Apr-08 5:51
sitebuilderShog94-Apr-08 5:51 
GeneralCHARTING Tool for .NET project! Pin
sidbaruah3-Apr-08 20:11
sidbaruah3-Apr-08 20:11 
GeneralRe: CHARTING Tool for .NET project! Pin
Paddy Boyd4-Apr-08 0:50
Paddy Boyd4-Apr-08 0:50 
QuestionProblem in firing events - ASP.NET Ajax Pin
Leonades2-Apr-08 23:04
Leonades2-Apr-08 23:04 
GeneralIIS problem with my localhost Pin
Ahmad Adnan2-Apr-08 20:48
Ahmad Adnan2-Apr-08 20:48 
GeneralRe: IIS problem with my localhost Pin
Mark J. Miller3-Apr-08 5:00
Mark J. Miller3-Apr-08 5:00 
QuestionHow to display IFRAME in the proper place in different resolution? Pin
biswa472-Apr-08 19:35
biswa472-Apr-08 19:35 
Questioncreate collapse menu Pin
hochoint1-Apr-08 17:22
hochoint1-Apr-08 17:22 
GeneralRe: create collapse menu Pin
Bradml1-Apr-08 20:32
Bradml1-Apr-08 20:32 
Generalsetting document size Pin
Force Code1-Apr-08 6:08
Force Code1-Apr-08 6:08 
GeneralRe: setting document size Pin
led mike1-Apr-08 6:30
led mike1-Apr-08 6:30 
GeneralRe: setting document size Pin
Force Code1-Apr-08 7:23
Force Code1-Apr-08 7:23 
GeneralRe: setting document size Pin
led mike1-Apr-08 7:52
led mike1-Apr-08 7:52 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.