📄 trailer.htm
字号:
loadingXml = true;
xmlDoc.load("/" + titleString + ".xml");
</SCRIPT>
<SCRIPT LANGUAGE="JavaScript">
function loadDoc()
{
if (xmlDoc.readyState == "4")
{
if (!updatingDoc)
{
start();
startTimer();
}
else
update();
}
else
window.setTimeout("loadDoc()",100);
}
function updateDoc()
{
if (xmlDoc.readyState == "4")
{
update()
//startTimer();
}
else
window.setTimeout("loadDoc()",100);
}
function start()
{
var temp = "";
var count = 0;
if (xmlDoc.parseError != 0)
{
document.bgColor = "red";
loadingXml = false;
return;
}
document.bgColor = "#CCCCCC";
rootElem = xmlDoc.documentElement;
addString("</TBODY></TFOOT></TABLE>");
count = displayNode( rootElem, 0, "");
addString("</THEAD><TBODY><TR>");
addString("<CAPTION><B>" + titleString + "<B></CAPTION>");
addString("<TABLE BORDER=4 CELLSPACING=0 CELLPADDING=3>");
if (blockLoading)
{
htmlData = "";
return;
}
content.innerHTML = htmlData;
document.title = "Device Object Dictionary";
loadingXml = false;
}
function update()
{
if (xmlDoc.parseError != 0)
{
document.bgColor = "red";
loadingXml = false;
return;
}
document.bgColor = "#CCCCCC";
rootElem = xmlDoc.documentElement;
formCount = 0;
updateNode( rootElem, 0, "");
loadingXml = false;
blockLoading = false;
}
function blockLoad()
{ blockLoading = true; }
function unBlockLoad()
{ blockLoading = false; }
function startTimer( )
{
var temp = 0;
temp = UpdateRate.value;
if (temp < 100)
temp = 100;
timerId = setTimeout( timerExpired, temp );
timerRunning = true;
}
function stopTimer( )
{
if (timerRunning)
clearTimeout( timerId );
timerRunning = false;
}
function timerExpired( )
{
startTimer( );
if (loadingXml)
return;
if (blockLoading)
return;
loadingXml = true;
updatingDoc = true;
htmlData = "";
//xmlDoc = new ActiveXObject("microsoft.xmldom");
xmlDoc.load("/" + titleString + ".xml");
updateDoc();
loadingXml = false;
blockLoading = false;
}
function addString( passedStr )
{
htmlData = passedStr + htmlData;
}
function displayName( passedNode, spanCount )
{
var node = passedNode;
var temp = "";
if (spanCount == 0)
temp = "<TD>" + node.nodeName + "</TD>\n";
else
temp = "<TD ROWSPAN="
+ (spanCount)
+ ">"
+ node.nodeName
+ "</TD>\n";
addString( temp );
}
//function openData( dataStr )
//{
//var titleStr = dataStr;
//var newWindow = window.open( "",
//"Data Display",
//"toolbar=no,scrollbars=yes" );
//newWindow.location.href = dataStr;
//newWindow.name = dataStr;
//}
function displayContent( passedNode, passedPath, readable, writeable )
{
var node = passedNode;
var temp = "";
var tempName;
tempName = passedPath;
if (passedPath == "")
tempName = "!";
if (writeable)
temp = "<TD VALIGN=BOTTOM><FORM NAME=\""
+ tempName
+ "\" METHOD=POST ACTION=/" + titleString
+ " onMouseOver=\"blockLoad()\""
+ " onMouseOut=\"unBlockLoad()\""
+ ">"
+ "<INPUT NAME=\"" + tempName + "\""
+ " TYPE=TEXT"
+ " VALUE="
+ node.text
+ "> </FORM></TD>";
else
temp = "<TD VALIGN=BOTTOM><FORM NAME=\""
+ tempName
+ "\" METHOD=POST ACTION=/" + titleString
+ " onMouseOver=\"blockLoad()\""
+ " onMouseOut=\"unBlockLoad()\""
+ ">"
+ "<INPUT NAME=\"" + tempName + "\""
+ " TYPE=TEXT"
+ " STYLE=\"background-color=#CCCCCC\""
+ " READONLY=\"true\""
+ " VALUE="
+ node.text
+ "> </FORM></TD>";
addString( temp );
formCount++;
}
function displayNode( passedNode, depth, pathName )
{
var node = passedNode;
var el = 0;
var count = 0;
var pathTail = "";
var readable = true;
var writeable = true;
if (depth != 0)
if (node.nodeName != "VMD")
pathName = pathName + node.nodeName;
if (node.hasChildNodes())
{
addString("</TR>");
for (el = node.childNodes.length - 1; el >= 0; el--)
{
if (node.childNodes(el).nodeName == "#text")
{
attrList = node.attributes;
for (attr = 0; attr < attrList.length; attr++)
{
if (attrList.item(attr).nodeName == "read")
readable = (attrList.item(attr).text != "False" );
if (attrList.item(attr).nodeName == "write")
{
writeable = (attrList.item(attr).text != "False" );
}
}
displayContent(node.childNodes(el), pathName, readable, writeable);
count = count + 1;
}
else
{
if (depth == 0)
pathTail = "";
else
pathTail = "$";
count += displayNode( node.childNodes(el),
depth + 1,
pathName + pathTail );
if (el != 0)
addString("<TR>");
}
}
displayName( node, count );
}
else
{
addString("</TR>\n");
displayContent( node , pathName, readable, writeable);
displayName( node, 0 );
count = count + 1;
}
return( count );
}
function updateNode( passedNode, depth, pathName )
{
var node = passedNode;
var el = 0;
var count = 0;
var pathTail = "";
if (depth != 0)
if (node.nodeName != "VMD")
pathName = pathName + node.nodeName;
if (node.hasChildNodes())
{
for (el = node.childNodes.length - 1; el >= 0; el--)
{
if (node.childNodes(el).nodeName == "#text")
{
//var tempName;
var index;
//tempName = pathName;
//if (pathName == "")
//tempName = "!";
index = document.forms.length - 1 - formCount;
if (index >= 0)
{
document.forms[ index ].elements[0].value = node.text;
formCount++;
}
}
else
{
if (depth == 0)
pathTail = "";
else
pathTail = "$";
updateNode( node.childNodes(el),
depth + 1,
pathName + pathTail );
}
}
}
}
</SCRIPT>
<STYLE TYPE="text/css">
FORM {margin-bottom:0px}
</STYLE>
</HEAD>
<BODY BGCOLOR=#CCCCCC STYLE="white-space:normal">
<DIV STYLE="text-align:right">
<B>Update Rate:</B>
<INPUT NAME="UpdateRate" TYPE=TEXT VALUE=1000>
</DIV>
<DIV ID="content" STYLE="white-space:normal">
</DIV>
</BODY>
</HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -