ค้นหาฝ่ายสนับสนุน

Avoid support scams. We will never ask you to call or text a phone number or share personal information. Please report suspicious activity using the “Report Abuse” option.

เรียนรู้เพิ่มเติม

JavaScript: Cannot load more than 4093 bytes into variable. String is truncated. In IE all works well.

  • 1 การตอบกลับ
  • 1 คนมีปัญหานี้
  • 2 ครั้งที่ดู
  • ตอบกลับล่าสุดโดย jscher2000 - Support Volunteer

more options

I request data from server. Server returns XML data. This data is processing. When variable size exeeds 4093, string is truncated. Code:

function handleGetVars (data) {
var xmlResponse = data;
if (xmlResponse == null) return;
xmlRoot = xmlResponse.documentElement;
if (!xmlResponse || !xmlRoot)
throw ("Wrong XML document structure:\n" + xmlHttp.responseText);
if (xmlRoot.nodeName == "parsererror")
throw ("Wrong XML document structure:\n" + xmlHttp.responseText);
numArray = xmlRoot.getElementsByTagName ("num");
nameArray = xmlRoot.getElementsByTagName ("name");
valueArray = xmlRoot.getElementsByTagName ("value");
var html = "<table>";
var num = 0;
var value = "";
if (numArray.length)
{
for (var i=0; i<nameArray.length; i++)
{
num = numArray.item(i).firstChild.data;
html += "<tr><td align='left'>";
html += nameArray.item(i).firstChild.data + "</td>\n";
html += "<td align='left'><div id=variable_" + num + ">";
value = valueArray.item(i).firstChild.data;
html += value + "</div></td>\n";
html += "<td><div id = 'btnBlock_" + num + "'>";
html += btnBlock (num);
html += "</div></td></tr>\n";
} // for
} // if
html += "</table>";
$('#variables').html(html);
} // handleGetVars
I request data from server. Server returns XML data. This data is processing. When variable size exeeds 4093, string is truncated. Code: <pre><nowiki>function handleGetVars (data) { var xmlResponse = data; if (xmlResponse == null) return; xmlRoot = xmlResponse.documentElement; if (!xmlResponse || !xmlRoot) throw ("Wrong XML document structure:\n" + xmlHttp.responseText); if (xmlRoot.nodeName == "parsererror") throw ("Wrong XML document structure:\n" + xmlHttp.responseText); numArray = xmlRoot.getElementsByTagName ("num"); nameArray = xmlRoot.getElementsByTagName ("name"); valueArray = xmlRoot.getElementsByTagName ("value"); var html = "<table>"; var num = 0; var value = ""; if (numArray.length) { for (var i=0; i<nameArray.length; i++) { num = numArray.item(i).firstChild.data; html += "<tr><td align='left'>"; html += nameArray.item(i).firstChild.data + "</td>\n"; html += "<td align='left'><div id=variable_" + num + ">"; value = valueArray.item(i).firstChild.data; html += value + "</div></td>\n"; html += "<td><div id = 'btnBlock_" + num + "'>"; html += btnBlock (num); html += "</div></td></tr>\n"; } // for } // if html += "</table>"; $('#variables').html(html); } // handleGetVars</nowiki></pre>

เปลี่ยนแปลงโดย cor-el เมื่อ

วิธีแก้ปัญหาที่เลือก

This forum focuses on end-user support. You can find more web development help on the mozillaZine Web Development board. That board also handles special characters better than this one (using BBCode code tags).

อ่านคำตอบนี้ในบริบท 👍 0

การตอบกลับทั้งหมด (1)

more options

วิธีแก้ปัญหาที่เลือก

This forum focuses on end-user support. You can find more web development help on the mozillaZine Web Development board. That board also handles special characters better than this one (using BBCode code tags).