Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

xml image tag

Status
Not open for further replies.

lyric

Programmer
May 31, 2000
3
US
I am making a jeopardy like game that works perfectly except for the images. The XML file loads the categories and the text questions/answers. On an occasional question I want the text to be an image. Here is the code to call the xml file and the code for the xml file. PLEASE HELP. There has to be a simple syntax to recognize an image.

//sets fullscren on startup
fscommand("fullscreen", "true");

//creates global variables assuming points is from jeopardy.xml
var points = 10;
//why is it named catigory instead of category
var catigory = 10;
// final = 0 not time for final jeopardy, 1 = time for final jeopardy
var final = 0;

//var correct is to determine the final answers of the teams for the final round. default is false

because they are not right yet
var correct1 = false;
var correct2 = false;
var correct3 = false;
var correct4 = false;
var correct5 = false;
var correct6 = false;


jeopardy=new XML();
jeopardy.ignoreWhite=true;
jeopardy.load("jeopardy.xml");
//if the xml node jeopardy load was a success do the following
jeopardy.onLoad = function (success){

_root.cat1.points = _root.jeopardy.firstChild.childNodes[0].attributes.name;
_root.cat2.points = _root.jeopardy.firstChild.childNodes[1].attributes.name;
_root.cat3.points = _root.jeopardy.firstChild.childNodes[2].attributes.name;
_root.cat4.points = _root.jeopardy.firstChild.childNodes[3].attributes.name;
_root.cat5.points = _root.jeopardy.firstChild.childNodes[4].attributes.name;

for (i=0;i< 5;i++){
for (j=0;j<5;j++){

_root[""+i+j].points =
_root.jeopardy.firstChild.childNodes.childNodes[j].attributes.points;
}
}
}

jeopardy.load("jeopardy.xml");


Partial XML file:

<?xml version = '1.0' encoding = 'utf-8'?>
<Jeopardy>
<category name = 'Blood'>
<first points = '100' answer = '100 answer'> 100 question </first>

<second points = '200' answer = '200 answer1'>200 question</second>
<third points = '300' answer = '300 answer1'>300 question</third>
<fourth points = '400' answer = '400 answer1'>400 question</fourth>
<fifth points = '500' answer = '500 answer1'>500 question</fifth>
</category>
...and so on

Thanking you in advance.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top