D
DoomedLung
I've tried and failed with this problem... basically I need to replace
the xml src element of a data island with an array item which holds
individual xml files.
I've been able to step through each array Item with back and next
buttons and display the item within alerts but now I need to apply this
to the actual xml data Island so it displays within the html page. here
is the code I have so far. Any contributions would be much appreciated
<html>
<body>
<script language="javascript">
// put your xml files here:
var xmlFiles = new
Array("198701_1.xml","198701_2.xml","198701_3.xml","198701_4.xml","198701_5.xml","198701_6.xml","198701_7.xml");
var all = new Array();
for(loop = 0; loop < xmlFiles.length ; loop++){
var xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
xmlDoc.async="false";
xmlDoc.load(xmlFiles[loop]);
all[loop] = xmlDoc.documentElement.xml;
}
var file = 0;
function next(){
if (file < 7){
all[file++];
}
alert(all[file]);
}
function back(){
if (file <= 7){
all[file--];
}
alert(all[file]);
}
function showXML(){
if(document.getElememtById('xmldso').src == ""){
document.getElememtById('xmldso').src = all[file];
}
}
</script>
<xml src="javascript:showXML()" id="xmldso" async="false"></xml>
<br /><b>Author:</b>
<span datasrc="#xmldso" datafld="author"></span><br /><br />
<br /><b>Question:</b>
<span datasrc="#xmldso" datafld="question"></span><br /><br />
<br /><b>Answer:</b>
<span datasrc="#xmldso" datafld="answer"></span><br /><br /><br /><br
/><hr>
<form>
<input type="button" onClick="back()" value="back">
<input type="button" onClick="next()" value="next">
</form>
<script language="javascript">
<!--
//-->
</script>
</body>
</html>
the xml src element of a data island with an array item which holds
individual xml files.
I've been able to step through each array Item with back and next
buttons and display the item within alerts but now I need to apply this
to the actual xml data Island so it displays within the html page. here
is the code I have so far. Any contributions would be much appreciated
<html>
<body>
<script language="javascript">
// put your xml files here:
var xmlFiles = new
Array("198701_1.xml","198701_2.xml","198701_3.xml","198701_4.xml","198701_5.xml","198701_6.xml","198701_7.xml");
var all = new Array();
for(loop = 0; loop < xmlFiles.length ; loop++){
var xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
xmlDoc.async="false";
xmlDoc.load(xmlFiles[loop]);
all[loop] = xmlDoc.documentElement.xml;
}
var file = 0;
function next(){
if (file < 7){
all[file++];
}
alert(all[file]);
}
function back(){
if (file <= 7){
all[file--];
}
alert(all[file]);
}
function showXML(){
if(document.getElememtById('xmldso').src == ""){
document.getElememtById('xmldso').src = all[file];
}
}
</script>
<xml src="javascript:showXML()" id="xmldso" async="false"></xml>
<br /><b>Author:</b>
<span datasrc="#xmldso" datafld="author"></span><br /><br />
<br /><b>Question:</b>
<span datasrc="#xmldso" datafld="question"></span><br /><br />
<br /><b>Answer:</b>
<span datasrc="#xmldso" datafld="answer"></span><br /><br /><br /><br
/><hr>
<form>
<input type="button" onClick="back()" value="back">
<input type="button" onClick="next()" value="next">
</form>
<script language="javascript">
<!--
//-->
</script>
</body>
</html>