1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132
| <html>
<head>
<script language="jscript" type="text/javascript">
var gobjCurrentPartSelected = null;
/*--------------------------------------------------------------
function SelectPart
Changes the selection to the specified part (i.e. table row tag)
ARGUMENTS:
objPart The table row to highlight.
RETURNS:
None
---------------------------------------------------------------*/
function SelectPart(objPart)
{
// Enable the Add Part button now that one of the parts is selected.
if (gobjCurrentPartSelected == null)
btnAddPart.disabled = false;
// If this is not the currently selected part, mark the new part as selected
// by switching it's CSS class. Unselect the currently selected part, if any.
if (objPart != gobjCurrentPartSelected)
{
if (gobjCurrentPartSelected)
gobjCurrentPartSelected.className = "";
gobjCurrentPartSelected = objPart;
gobjCurrentPartSelected.className = "selected";
}
}
/*--------------------------------------------------------------
function AddPartToInvoice
Calls a business logic function to insert the part into the document.
ARGUMENTS:
objPart The part object to insert.
RETURNS:
None
---------------------------------------------------------------*/
function AddPartToInvoice(objPart)
{
// Call the insertPartFromCatalog function in the business logic, passing
// the details for the part.
window.external.Window.XDocument.Extension.InsertPartFromCatalog(objPart.PartNumber, objPart.PartDescription, objPart.UnitCost);
}
function addtable()
{
var xhr_object = null;
xhr_object = new ActiveXObject("Microsoft.XMLHTTP");
xhr_object.open("GET", "import.xml", true);
xhr_object.onreadystatechange = function()
{
if(xhr_object.readyState == 4)
{
var message = "";
for(i in xhr_object.responseXML)
message += i+" "+xhr_object.responseXML[i];
alert(message);
alert(xhr_object.responsetext);
alert(xhr_object.responseXML);
alert(xhr_object.responseXML.documentElement);
alert(xhr_object.responseXML.childNodes.length);
var trs = xhr_object.responseXML.getElementsByTagName('tr');
var l= trs.length ;
for(var j=0;j < l ; j++)
{
document.getElementById("toto").appendChild(trs[j]);
}
}
}
xhr_object.send(null);
}</script>
<style type="text/css">
body, table, td, th
{
font-family: Verdana;
font-size: 10pt;
}
table#partList
{
border-collapse:collapse;
word-wrap:break-word;
border-top: "1px #a9b6cb solid";
border-left: "1px #a9b6cb solid";
border-right: "1px #a9b6cb solid";
}
#partlist thead
{
text-align: left;
background-color:#7389af;
color: white;
}
#partList tr td, #partList tr th
{
border-bottom: "1px #a9b6cb solid";
}
table#partlist tr td, table#partlist tr th
{
padding: 1px 4px 1px 4px;
}
table#partlist tr.selected
{
background-color: #0000A0;
color: white;
}
</style>
</head>
<body>
<table id="partList" cellspacing="0" width="100%">
<thead>
<tr>
<th width="10%">Item</th>
<th width="90%">Description</th>
</tr>
</thead>
<tbody xmlns="http://www.w3.org/1999/xhtml" id="toto">
</tbody>
</table>
<p style="text-align: center">
<button id="btnAddPart" onClick="AddPartToInvoice(gobjCurrentPartSelected)">Add To Invoice</button>
<button id="btnAddPart" onClick="addtable()">load</button>
</p>
</body>
</html> |
Partager