Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. innerHTML - unknown runtime error.

innerHTML - unknown runtime error.

Scheduled Pinned Locked Moved Web Development
helpjavascriptcsssysadmin
4 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    Kiran S S
    wrote on last edited by
    #1

    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"%> <% 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 & "" & rsItem.Fields("details") & "" & vbCrLf rsItem.MoveNext loop rsItem.Close set rsItem = nothing con.close set con = nothing %> New Purchase 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 </x-turndown>

    S L S 3 Replies Last reply
    0
    • K Kiran S S

      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"%> <% 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 & "" & rsItem.Fields("details") & "" & vbCrLf rsItem.MoveNext loop rsItem.Close set rsItem = nothing con.close set con = nothing %> New Purchase 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 </x-turndown>

      S Offline
      S Offline
      Shog9 0
      wrote on last edited by
      #2

      Boil it down to the smallest possible amount of code necessary to reproduce the problem. The stuff you've posted has a fair bit of commented-out code, do-nothing code, and code that depends on your particular scenario (and so cannot be used to reproduce the problem by anyone here who might be interested in doing so.)

      Citizen 20.1.01

      'The question is,' said Humpty Dumpty, 'which is to be master - that's all.'

      1 Reply Last reply
      0
      • K Kiran S S

        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"%> <% 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 & "" & rsItem.Fields("details") & "" & vbCrLf rsItem.MoveNext loop rsItem.Close set rsItem = nothing con.close set con = nothing %> New Purchase 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 </x-turndown>

        L Offline
        L Offline
        Lost User
        wrote on last edited by
        #3

        innerHTML does not work well with tables in IE. Firefox works well with it though. I am not sure whether innerHTML was intended to work with nested elements. I found that out when I tried this:

        table_ref = document.getElementById(table_name);
        row_innerHTML = table_ref.rows[1].innerHTML;
        new_row_ref = table_ref.insertRow(table_ref.rows.length);
        new_row_ref.innerHTML = row_innerHTML;
        

        The line in block letters produced a runtime error in IE. So, I replaced it with:

        // get the node for the table
        table_ref = document.getElementById(table_name);
        
        var table_row_ref = table_ref.rows[1];
        new_row_ref = table_ref.insertRow(table_ref.rows.length);
        cellcount = table_row_ref.cells.length;
        for (cellindex = 0; cellindex < cellcount; ++cellindex)
        {
            new_col_ref = table_row_ref.cells[cellindex].cloneNode(true);
            new_row_ref.appendChild(new_col_ref);
        }
        

        Instead of trying to use HTML code, you may also have to use insertRow(), insertColumn() etc. If you want to remove existing rows, use deleteRow() function.

        1 Reply Last reply
        0
        • K Kiran S S

          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"%> <% 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 & "" & rsItem.Fields("details") & "" & vbCrLf rsItem.MoveNext loop rsItem.Close set rsItem = nothing con.close set con = nothing %> New Purchase 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 </x-turndown>

          S Offline
          S Offline
          Soumini Ramakrishnan
          wrote on last edited by
          #4

          see wheather any nonexisting control is referenced

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups