Tags:
xml
Hej alle
Nogen som kan se hvad der galt med dette javascript !
prøver på at slette den første node i tests.xml
<grddata>
<Itemid>1</Itemid>
<Nr>502</Nr>
<Desrc>Test1</Desrc>
<Price>48,00</Price>
<Day>8</Day>
<Month>4</Month>
<Year>2005</Year>
</grddata>
<XML ID="Kassestrimmel" SRC = "tests.xml"></XML>
<form id="Form1" method="post" runat="server">
<script language = "javascript">
function sletpost()
{
var xmlDoc = new ActiveXObject("Microsoft.XMLDOM")
xmlDoc.async="false"
xmlDoc.load("tests.xml")
var sletId = document.getElementById('txttest').value;
Kassestrimmel.recordset.moveFirst();
while (!Kassestrimmel.recordset.EOF)
var Slet_node = xmlDoc.selectSingleNode("/NewDataSet/grddata[itemid='" + sletId + "']")
xmlDoc.documentElement.removeChild(Slet_node)
Kassestrimmel.recordset.moveNext();
}
</script>
<IMG onmouseup="sletpost()" id="move" style="Z-INDEX: 101; LEFT: 328px; VISIBILITY: visible; WIDTH: 16px; POSITION: absolute; TOP: 232px; HEIGHT: 16px"
height="16" alt="" src="../Images/Drag_show.gif" width="16" runat="server">
<asp:TextBox id="txttest" style="Z-INDEX: 103; LEFT: 320px; POSITION: absolute; TOP: 112px" runat="server">1</asp:TextBox>
</form>
_____________________________________
Og xml.filen
____________________________________
<?xml version="1.0" standalone="yes"?>
<NewDataSet>
<grddata>
<Itemid>1</Itemid>
<Nr>502</Nr>
<Desrc>Test1</Desrc>
<Price>48,00</Price>
<Day>8</Day>
<Month>4</Month>
<Year>2005</Year>
</grddata>
<grddata>
<Itemid>2</Itemid>
<Nr>503</Nr>
<Desrc>Test2</Desrc>
<Price>58,00</Price>
<Day>9</Day>
<Month>4</Month>
<Year>2005</Year>
</grddata>
<grddata>
<Itemid>3</Itemid>
<Nr>504</Nr>
<Desrc>Test3</Desrc>
<Price>88,00</Price>
<Day>10</Day>
<Month>4</Month>
<Year>2005</Year>
</grddata>
</NewDataSet>
Jens
2 svar postet i denne tråd vises herunder
1 indlæg har modtaget i alt 1 karma
0