|
OK I have ready why, but it makes no sense
to me as I have a full blow table generation script that I wrote to run a
Timing and Scoring Application. Is this just a problem with prototype or a
real bug in general? Attached is my script that I wrote that works fine. You can see it in action here: http://209.43.92.220/html/
From:
[EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Whitcraft, Jon Hello, I want to use the builder modules for an admin tool
I’m currently working on but I just all the note that I cannot create td
and tr tags with it. It works fine in FF but not it IE. Can
someone please explain why this is? Thanks..
******************** ******************** This E-mail (and attachments) may contain
confidential/privileged information intended only for the named addressee(s).
If you are not an intended recipient, do not read, copy, disseminate or take
any action based on the content of this E-mail. Please notify the sender by
reply E-mail and erase this E-mail from your system. Your assistance is
appreciated. E-mail transmission may not be secure or error-free. The company
is not responsible for any loss/damage arising from any virus transmitted.
******************** ******************** | ||||||||
// globalize the session data var sdEventInfo = new Array(); var sdLeaderInfo = new Array(); var sdMiscInfo = new Array();
var firstRun = 1;
function loadCommentary(xmlDoc) {
//comment
var x = xmlDoc.getElementsByTagName('comment');
if(x.length > 0) {
for(j=0;j<x[0].childNodes.length;j++) {
if (x[0].childNodes[j].nodeType != 1) continue;
parent.document.getElementById('commentary-text').innerHTML =
x[0].childNodes[j].firstChild.nodeValue;
break;
}
} else {
parent.document.getElementById('commentary-text').innerHTML = ''
}
setTimeout('processComments()',15000);
}
function loadWeather(xmlDoc) {
var x = xmlDoc.getElementsByTagName('weather');
try {
if(x.length > 0) {
for(j=0;j<x[0].childNodes.length;j++) {
if (x[0].childNodes[j].nodeType != 1) continue;
parent.document.getElementById('current-weather').innerHTML =
x[0].childNodes[j].firstChild.nodeValue;
break;
}
} else {
parent.document.getElementById('current-weather').innerHTML = ''
}
} catch (e) {
parent.document.getElementById('current-weather').innerHTML =
''
}
setTimeout('processWeather()',1800000)
}
function loadLeaderInfo() {
var doc = parent.document;
var carNum = doc.getElementById('currentCarNum').value;
if(carNum != sdLeaderInfo[5]) {
// load new leader
var e = doc.getElementById('leader-text');
e.innerHTML = sdLeaderInfo[0] + ' ('+sdLeaderInfo[5]+')<br
/>'+sdLeaderInfo[4]+'<br />'+sdLeaderInfo[6];
if(sdLeaderInfo[6] == "D/I/F") {
doc.getElementById('leader-carshot').src =
'http://scoring.indycar.com/images/cars/proseries/'+sdMiscInfo[8]+'.jpg';
doc.getElementById('leader-headshot').src =
'http://scoring.indycar.com/images/drivers/proseries/'+sdMiscInfo[8]+'_sm.jpg';
} else {
doc.getElementById('leader-carshot').src =
'http://scoring.indycar.com/images/cars/indycar/'+sdMiscInfo[8]+'.jpg';
doc.getElementById('leader-headshot').src =
'http://scoring.indycar.com/images/drivers/indycar/'+sdMiscInfo[8]+'_sm.jpg';
}
doc.getElementById('currentCarNum').value = sdLeaderInfo[5];
}
}
function loadSessionData() {
var doc = parent.document;
doc.getElementById('fastest-lap').innerHTML = sdMiscInfo[0] + '
('+sdMiscInfo[1]+')';
doc.getElementById('elapsed-time').innerHTML = sdMiscInfo[5];
doc.getElementById('average-speed').innerHTML = sdLeaderInfo[3];
doc.getElementById('cautions').innerHTML = sdMiscInfo[3];
doc.getElementById('caution-laps').innerHTML = sdMiscInfo[4];
doc.getElementById('cars-running').innerHTML = sdMiscInfo[2];
doc.getElementById('total-laps').innerHTML = sdMiscInfo[7];
}
function storeSessionData(xmlDoc) {
var x = xmlDoc.getElementsByTagName('event_info');
if(x.length > 0) {
// file loaded
sdEventInfo = new Array();
for(j=0;j<x[0].childNodes.length;j++) {
if (x[0].childNodes[j].nodeType != 1) continue;
try {
var theData =
x[0].childNodes[j].firstChild.nodeValue;
} catch (e) {
var theData = " ";
}
sdEventInfo.push(theData);
}
var x = xmlDoc.getElementsByTagName('leader_info');
sdLeaderInfo = new Array();
for(j=0;j<x[0].childNodes.length;j++) {
if (x[0].childNodes[j].nodeType != 1) continue;
try {
var theData =
x[0].childNodes[j].firstChild.nodeValue;
} catch (e) {
var theData = " ";
}
sdLeaderInfo.push(theData);
}
var x = xmlDoc.getElementsByTagName('misc_info');
sdMiscInfo = new Array();
for(j=0;j<x[0].childNodes.length;j++) {
if (x[0].childNodes[j].nodeType != 1) continue;
try {
var theData =
x[0].childNodes[j].firstChild.nodeValue;
} catch (e) {
var theData = " ";
}
sdMiscInfo.push(theData);
}
}
if(firstRun == 1) {
loadMasterInfo();
firstRun = 0;
}
var a = new
importXML('../xml_files/session_results.xml',createTable,false);
//importXML('../xml_files/session_results.xml','createTable',false);
}
function loadMasterInfo() {
var e = parent.document;
e.getElementById('trackname').innerHTML = sdEventInfo[6];
e.getElementById('eventname').innerHTML = sdEventInfo[3];
e.getElementById('trackpic').src =
"/images/tracks/"+sdEventInfo[4]+".jpg";
e.getElementById('tracklogo').src =
"/images/logos/"+sdEventInfo[4]+".jpg";
e.getElementById('event-logo').src =
"/images/events/"+sdEventInfo[4]+".jpg";
e.getElementById('order_tickets_link').href = sdEventInfo[5];
}
function createTable(xmlDoc) {
var doDisplay='true';
navigator.appVersion.indexOf("MSIE") > 0 ? isIE = true : isIE = false;
/* Konqueror insists that the timer can keep running until there are 20
alerts (the file is still in the list of files to
be checked until at least one alert is dismissed), so I use a timer to
delay the alert and allow my script to stop
checking the file */
//if( xmlDoc.documentElement && xmlDoc.documentElement.tagName &&
xmlDoc.documentElement.tagName.toUpperCase() == 'HTML' ) {
// setTimeout('alert(\'For no apparent reason, your browser has
turned the clean XML into HTML based garbage.\\nScript aborted.\');',50);
return; }
var fields = new Array(0,2,1,5,8,9,10,6,7,4,3,16);
var headers = new Array('Pos','Driver','Diff','B Time','B Speed','B
Lap','L Time','L Speed','L Lap','C/E/T','Status');
var x = xmlDoc.getElementsByTagName('record');
if(x.length > 0) {
var newEl = document.createElement('TABLE');
if(isIE) {
newEl.border='0';
newEl.cellPadding='2';
newEl.cellSpacing='0';
newEl.id='scoringtable';
newEl.width='100%';
} else {
newEl.setAttribute('border','0');
newEl.setAttribute('cellpadding',2);
newEl.setAttribute('cellspacing',0);
newEl.setAttribute('id','scoringtable');
newEl.setAttribute('width','100%');
}
var tmp = document.createElement('TBODY');
newEl.appendChild(tmp);
var row = document.createElement('TR');
if(isIE) {
row.className='odd header';
} else {
row.setAttribute('class','odd header');
}
var container = document.createElement('TD');
if(isIE) {
container.className='left';
container.colSpan='5';
} else {
container.setAttribute('class','left');
container.setAttribute('colspan',5);
}
container.appendChild(document.createTextNode(sdEventInfo[3]));
row.appendChild(container);
var container = document.createElement('TD');
if(isIE) {
container.colSpan='2';
} else {
container.setAttribute('colspan',2);
}
container.appendChild(document.createTextNode('\u00a0'));
row.appendChild(container);
var container = document.createElement('TD');
if(isIE) {
container.className='right';
container.colSpan='4';
container.id='flag-status';
} else {
container.setAttribute('colspan',4);
container.setAttribute('class','right');
container.setAttribute('id','flag-status');
}
container.appendChild(document.createTextNode('Track
Status:\u00a0\u00a0'));
var newDiv = document.createElement('DIV');
if(isIE) {
newDiv.id='flag';
newDiv.className=sdLeaderInfo[2].toLowerCase();
} else {
newDiv.setAttribute('id','flag');
newDiv.setAttribute('class',sdLeaderInfo[2].toLowerCase());
}
newDiv.appendChild(document.createTextNode('\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0'));
container.appendChild(newDiv);
row.appendChild(container);
tmp.appendChild(row);
var row = document.createElement('TR');
//row.setAttribute('class','even header');
row.className='even header';
for (j=0;j<headers.length;j++) {
var container = document.createElement('TD');
if(j!=1)
container.className = 'center';
var theData = document.createTextNode(headers[j]);
container.appendChild(theData);
row.appendChild(container);
}
tmp.appendChild(row);
for (i=0;i<x.length;i++)
{
var arrTmp = new Array();
var arrRaw = new Array();
for (j=0;j<x[i].childNodes.length;j++)
{
if (x[i].childNodes[j].nodeType != 1) continue;
try {
var theData =
document.createTextNode(x[i].childNodes[j].firstChild.nodeValue);
var rawData =
x[i].childNodes[j].firstChild.nodeValue;
} catch (e) {
var theData =
document.createTextNode('\u00a0')
var rawData = " ";
}
arrTmp.push(theData);
arrRaw.push(rawData);
}
var row = document.createElement('TR');
if(i % 2) {
var rowClass='even';
} else {
var rowClass='odd';
}
for(y=0;y<fields.length;y++) {
var f = fields[y];
if(f != 1) {
var container =
document.createElement('TD');
if(y == 0 || y == 2 || y == 5 || y == 8
|| y == 9 || y == 10) {
//container.setAttribute('class','center');
container.className='center'
}
if(f == 2) {
var newSpan =
document.createElement("span");
var newText =
document.createTextNode("This is a new sentence.");
newSpan.appendChild(arrTmp[2]);
newSpan.appendChild(document.createTextNode(' ('));
newSpan.appendChild(arrTmp[1]);
newSpan.appendChild(document.createTextNode(')'));
container.appendChild(newSpan);
} else {
container.appendChild(arrTmp[f]);
}
row.appendChild(container);
if(f == 16) {
if(arrRaw[16].toLowerCase() ==
"down") {
rowClass = rowClass + "
down-row";
//alert(rowClass);
}
if(arrRaw[16].toLowerCase() ==
"up") {
rowClass = rowClass + "
up-row";
//alert(rowClass);
}
}
//row.setAttribute('class',rowClass);
row.className = rowClass;
}
}
tmp.appendChild(row);
}
} else {
doDisplay='false';
}
if(doDisplay == 'true') {
try {
if(document.getElementById('scoringtable')) {
document.getElementById('writeroot').replaceChild(newEl,document.getElementById('scoringtable'));
} else {
document.getElementById('writeroot').appendChild(newEl);
}
} catch (e) {}
if(sdMiscInfo[9] == 'y') {
document.getElementById('quals').style.display =
"block";
document.getElementById('quals-text').style.display =
"block";
setTimeout('initPage()',30000);
} else {
document.getElementById('quals').style.display = "none";
document.getElementById('quals-text').style.display =
"none";
setTimeout('initPage()',10000);
}
loadLeaderInfo();
} else {
// data was in complete. try again in 3 sec.
setTimeout('initPage()',10000);
}
loadSessionData();
}
function popitup(url,wheight,wwidth,wname) {
newwindow=window.open(url,wname,'height='+wheight+',width='+wwidth+',scrollbars=yes');
if (window.focus) {newwindow.focus()}
return false;
}
function showDiv() {
document.getElementById('writeroot').style.display = "block";
}
function processWeather() {
var a = new
importXML('../xml_files/weather_schedule.xml',loadWeather,false);
//importXML('../xml_files/weather_schedule.xml','loadWeather',false);
}
function processComments() {
var a = new
importXML('../xml_files/commentary.xml',loadCommentary,false);
//importXML('../xml_files/commentary.xml','loadCommentary',false);
}
function initPage() {
var a = new
importXML('../xml_files/session_data.xml',storeSessionData,false);
//importXML('../xml_files/session_data.xml','storeSessionData',false);
}_______________________________________________ Rails-spinoffs mailing list [email protected] http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
