Solved

Syntax error missing a Bracket I can't find

Posted on 2013-11-04
2
204 Views
Last Modified: 2013-11-05
Missing something trying to incorporate a function.

<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Untitled Document</title>
<style type="text/css">
.title {
	color: #FFF;
	font-family: Arial, Helvetica, sans-serif;
	font-size: 25px;
    font-weight: bold;
}
.textborder {
	border: medium solid #063;
	font-family: Arial, Helvetica, sans-serif;
	font-size: 12px;
	color: #000;
	text-align: center;
	vertical-align: middle;
}
.tablebord {
	border: medium solid #060;
}
</style>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js" type="text/javascript"></script>
   
        <script type="text/javascript">
            var xmlPath = '.' //'/xml/nfl/scores/real';
            var xmlGameID = '4295'; 
            var counterXml = 0;
            var counterSeq = 1; // 1 = start from the beginning (full match replay), use -1 to start at end (then it will also search for start of last drive automatically now)
            var counterInit = false;
            var xmlGameDrive = 4295;
			var msg;
			var PossID,PlaySeq,PossIDbak,Quarter,TimeLeft,ResultingToGo,ResultingDown,TotalYards,PlayType,ScoringPlay,FinalYard;
			function gettext() {
              
                $.ajax({
                    type: "GET",
                    url: xmlPath + "/" + xmlGameDrive + '_' + "DRIVE" + ".xml",
                    dataType: "xml",
                    success: function (data, textStatus, jqXHR) {

                        var d = $(data);
var Play = d.find('Play');
	   PossID = Play.attr('PossID');
                       
                        if (counterSeq == -1) { // init to last Seq in file
                            lastSeq = 1 * d.find('Play').last().attr('Seq');
                            if (lastSeq > counterSeq) {
                                counterSeq = lastSeq; // skip to end
                            }
                            counterInit = true;
                        }

                        msg = "";
                        
                        var PlaySeq = d.find('Play[Seq="' + counterSeq + '"]');
                        if (PlaySeq.length > 0) {
                            PossIDbak = PossID;
                            PossID = PlaySeq.attr('PossID');

                            // find start of current DRIVE based on PossID
                            if (counterInit) {
                                counterInit = false;
                                var playNodes = d.find('Play');
                                for (var intCounter = playNodes.length - 1; intCounter >= 0; intCounter--) {
                                    var tempSeq = $(playNodes[intCounter]).attr('Seq');
                                    if (tempSeq < counterSeq) {
                                        if ($(playNodes[intCounter]).attr('PossID') == PossID) {
                                            counterSeq = tempSeq;
                                        } else {
                                            break;
                                        }
                                    }
                                }
                            }

	   $('#imgcur').attr('src', 'http://powerzsoftware.com/tsn/nfl/PS/' + PossID + '.png');
                            msg = PlaySeq.find('narrative').attr('text');
                            $('#txtGametext').html(msg);
                           
                            Quarter = PlaySeq.attr('Quarter');
							$('#txtQ').html(Quarter);
                            TimeLeft = (PlaySeq.attr('TimeLeft'))
							$('#txttime').html(TimeLeft);
                            PlayType = (PlaySeq.attr('PlayType'));
							$('#txtplaytype').html(PlayType);
                            TotalYards = (PlaySeq.attr('TotalYards'));
							$('#txtYdsgain').html(TotalYards);
                            
                            FinalYard = (PlaySeq.attr('FinalYard'));
							$('#txtballon').html(FinalYard);
                            ResultingDown = (PlaySeq.attr('ResultingDown'));
							$('#txtdown').html(ResultingDown);
                           
                            ResultingToGo = (PlaySeq.attr('ResultingToGo'));
                            $('#txtyards').html(ResultingToGo);
                            
               prevplays(d);

                           counterSeq++;
                        } else {
                            lastSeq = 1 * d.find('Play').last().attr('Seq');
                            if (lastSeq > counterSeq) {
                                counterSeq++; // skip missing Seq
                            }
                        }


                    },
                    error: function () {
                        //counterXml = -1;
                    }
                });
            }
			function teamlogo() {
			 $('#imgcur1').attr('src', 'http://powerzsoftware.com/tsn/nfl/PS/' + PossID + '.png');	
			}
			
			function prevplays(d) {
    d.find('Play').each(function(i, Play){
        var playNode = $(Play);
        var tr = $('<tr/>');
        tr.append('<td>teamlogo();</td><td>' + playNode.attr('TimeLeft') + '</td><td>' + playNode.attr('Quarter') + '</td><td>' + playNode.attr('Playtype') + '</td><td>&amp;</td><td>' + playNode.attr('Totalyards') + '</td><td>' + playNode.attr('FinalYard') + '</td><td>' + playNode.attr('ResultingDown') + '</td><td>' + playNode.attr('ResultingDown') '</td><td><BR>
		 + playNode.find('narrative').attr('text') + '</td>');
        $('#scrolltable').append(tr);
    });
}
          
			</script>
</head>

<body>
<table width="750" height="113" border="0" class="textborder">
  <tr>
    <td colspan="8" bgcolor="#006633"><div align="center" class="title">Current Play</div></td>
  </tr>
  <tr>
    <td width="99" bgcolor="#E5E5E5"><div align="center"><strong>Team</strong></div></td>
    <td width="85" bgcolor="#E5E5E5"><div align="center"><strong>Quarter</strong></div></td>
    <td width="91" bgcolor="#E5E5E5"><div align="center"><strong>TimeLeft</strong></div></td>
    <td width="110" bgcolor="#E5E5E5"><div align="center"><strong>Playtype</strong></div></td>
    <td width="99" bgcolor="#E5E5E5"><div align="center"><strong>Yards Gained</strong></div></td>
    <td width="86" bgcolor="#E5E5E5"><div align="center"><strong>Ball on the</strong></div></td>
    <td width="57" bgcolor="#E5E5E5"><div align="center"><strong>Down</strong></div></td>
    <td width="89" bgcolor="#E5E5E5"><div align="center"><strong>Yards to go</strong></div></td>
  </tr>
  <tr>
    <td height="56" bgcolor="#FFFF99"><div align="center"><img src="http://powerzsoftware.com/tsn/nfl/PS/082.png" name="imgcur1" width="60" height="45" id="imgcur1"></div></td>
    <td bgcolor="#FFFF99"><div align="center" id="txtQ"></div></td>
    <td bgcolor="#FFFF99"><div align="center" id="txttime"></div></td>
    <td bgcolor="#FFFF99"><div align="center" id="txtplaytype"></div></td>
    <td bgcolor="#FFFF99"><div align="center" id="txtYdsgain"></div></td>
    <td bgcolor="#FFFF99"><div align="center" id="txtballon"></div></td>
    <td bgcolor="#FFFF99"><div align="center" id="txtdown"></div></td>
    <td bgcolor="#FFFF99"><div align="center" id="txtyards"></div></td>
  </tr>
</table>
<table width="750" height="55" border="0" class="textborder">
  <tr>
    <td bgcolor="#FFFF66"><p align="center" id="txtGametext">&nbsp;</p>
    <p>&nbsp;</p></td>
  </tr>
</table>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>Football Field with drawn lines will go here!</p>
<table width="750" border="0">
  <tr>
    <td bgcolor="#006633"><div align="center" class="title"> Play by Play Game Log</div></td>
  </tr>
</table>
<table width="750" border="0">
  <tr bgcolor="#E6E6E6" class="textborder">
    <td width="104"><strong>Team</strong></td>
    <td width="82"><strong>Quarter</strong></td>
    <td width="89"><strong>TimeLeft</strong></td>
    <td width="108"><strong>Playtype</strong></td>
    <td width="96"><strong>Yards Gained</strong></td>
    <td width="83"><strong>Ball on the</strong></td>
    <td width="61"><strong>Down</strong></td>
    <td width="93"><strong>Yards to go</strong></td>
  </tr>
</table>
<div style='height: 400px; overflow-y: scroll;'>
<table width="750" border="0" class="tablebord" id="scrolltable">
  <tr bgcolor="#FFFF99">
    <td width="106"><div align="center">
      <p><img src="http://powerzsoftware.com/tsn/nfl/PS/082.png" alt="" name="imgcur" width="60" height="45" id="imgcur2"></p>
    </div></td>
    <td width="78"><div align="center"></div></td>
    <td width="88"><div align="center"></div></td>
    <td width="109"><div align="center"></div></td>
    <td width="96"><div align="center"></div></td>
    <td width="83"><div align="center"></div></td>
    <td width="59"><div align="center"></div></td>
    <td width="89"><div align="center"></div></td>
  </tr>
  <tr>
    <td colspan="8" bgcolor="#FFFF66"><div align="center">
      <p>&nbsp;</p>
      <p>&nbsp;</p>
    </div></td>
  </tr>
</table>
<table width="750" border="0">
  <tr>
    <td><div align="center">
      <input type="submit" name="btnScore" id="btnScore" value="Scoring Plays">
      <input type="submit" name="btnCompletes" id="btnCompletes" value="Completed Passes">
      <input type="submit" name="btnCompletes2" id="btnCompletes2" value="Sacks">
      <input type="submit" name="btnCompletes3" id="btnCompletes3" value="Interceptions">
    </div></td>
  </tr>
</table>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp; </p>
<script>
var myVar=setInterval(function(){myTimer()},1000);

function myTimer()
{

gettext();

  </script>
</body>
</html>

Open in new window

0
Comment
Question by:powerztom
2 Comments
 
LVL 82

Accepted Solution

by:
leakim971 earned 500 total points
ID: 39622289
Lines 126, 228 :
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Untitled Document</title>
<style type="text/css">
.title {
	color: #FFF;
	font-family: Arial, Helvetica, sans-serif;
	font-size: 25px;
    font-weight: bold;
}
.textborder {
	border: medium solid #063;
	font-family: Arial, Helvetica, sans-serif;
	font-size: 12px;
	color: #000;
	text-align: center;
	vertical-align: middle;
}
.tablebord {
	border: medium solid #060;
}
</style>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js" type="text/javascript"></script>
   
        <script type="text/javascript">
            var xmlPath = '.' //'/xml/nfl/scores/real';
            var xmlGameID = '4295'; 
            var counterXml = 0;
            var counterSeq = 1; // 1 = start from the beginning (full match replay), use -1 to start at end (then it will also search for start of last drive automatically now)
            var counterInit = false;
            var xmlGameDrive = 4295;
			var msg;
			var PossID,PlaySeq,PossIDbak,Quarter,TimeLeft,ResultingToGo,ResultingDown,TotalYards,PlayType,ScoringPlay,FinalYard;
			function gettext() {
              
                $.ajax({
                    type: "GET",
                    url: xmlPath + "/" + xmlGameDrive + '_' + "DRIVE" + ".xml",
                    dataType: "xml",
                    success: function (data, textStatus, jqXHR) {

                        var d = $(data);
var Play = d.find('Play');
	   PossID = Play.attr('PossID');
                       
                        if (counterSeq == -1) { // init to last Seq in file
                            lastSeq = 1 * d.find('Play').last().attr('Seq');
                            if (lastSeq > counterSeq) {
                                counterSeq = lastSeq; // skip to end
                            }
                            counterInit = true;
                        }

                        msg = "";
                        
                        var PlaySeq = d.find('Play[Seq="' + counterSeq + '"]');
                        if (PlaySeq.length > 0) {
                            PossIDbak = PossID;
                            PossID = PlaySeq.attr('PossID');

                            // find start of current DRIVE based on PossID
                            if (counterInit) {
                                counterInit = false;
                                var playNodes = d.find('Play');
                                for (var intCounter = playNodes.length - 1; intCounter >= 0; intCounter--) {
                                    var tempSeq = $(playNodes[intCounter]).attr('Seq');
                                    if (tempSeq < counterSeq) {
                                        if ($(playNodes[intCounter]).attr('PossID') == PossID) {
                                            counterSeq = tempSeq;
                                        } else {
                                            break;
                                        }
                                    }
                                }
                            }

	   $('#imgcur').attr('src', 'http://powerzsoftware.com/tsn/nfl/PS/' + PossID + '.png');
                            msg = PlaySeq.find('narrative').attr('text');
                            $('#txtGametext').html(msg);
                           
                            Quarter = PlaySeq.attr('Quarter');
							$('#txtQ').html(Quarter);
                            TimeLeft = (PlaySeq.attr('TimeLeft'))
							$('#txttime').html(TimeLeft);
                            PlayType = (PlaySeq.attr('PlayType'));
							$('#txtplaytype').html(PlayType);
                            TotalYards = (PlaySeq.attr('TotalYards'));
							$('#txtYdsgain').html(TotalYards);
                            
                            FinalYard = (PlaySeq.attr('FinalYard'));
							$('#txtballon').html(FinalYard);
                            ResultingDown = (PlaySeq.attr('ResultingDown'));
							$('#txtdown').html(ResultingDown);
                           
                            ResultingToGo = (PlaySeq.attr('ResultingToGo'));
                            $('#txtyards').html(ResultingToGo);
                            
               prevplays(d);

                           counterSeq++;
                        } else {
                            lastSeq = 1 * d.find('Play').last().attr('Seq');
                            if (lastSeq > counterSeq) {
                                counterSeq++; // skip missing Seq
                            }
                        }


                    },
                    error: function () {
                        //counterXml = -1;
                    }
                });
            }
			function teamlogo() {
			 $('#imgcur1').attr('src', 'http://powerzsoftware.com/tsn/nfl/PS/' + PossID + '.png');	
			}
			
			function prevplays(d) {
    d.find('Play').each(function(i, Play){
        var playNode = $(Play);
        var tr = $('<tr/>');
		var str = '<td>teamlogo();</td><td>' + playNode.attr('TimeLeft') + '</td><td>' + playNode.attr('Quarter') + '</td><td>' + playNode.attr('Playtype') + '</td><td>&amp;</td><td>' + playNode.attr('Totalyards') + '</td><td>' + playNode.attr('FinalYard') + '</td><td>';
		str += playNode.attr('ResultingDown') + '</td><td>' + playNode.attr('ResultingDown') + '</td><td><br />' + playNode.find('narrative').attr('text') + '</td>';
        tr.append(str);
        $('#scrolltable').append(tr);
    });
}
          
			</script>
</head>

<body>
<table width="750" height="113" border="0" class="textborder">
  <tr>
    <td colspan="8" bgcolor="#006633"><div align="center" class="title">Current Play</div></td>
  </tr>
  <tr>
    <td width="99" bgcolor="#E5E5E5"><div align="center"><strong>Team</strong></div></td>
    <td width="85" bgcolor="#E5E5E5"><div align="center"><strong>Quarter</strong></div></td>
    <td width="91" bgcolor="#E5E5E5"><div align="center"><strong>TimeLeft</strong></div></td>
    <td width="110" bgcolor="#E5E5E5"><div align="center"><strong>Playtype</strong></div></td>
    <td width="99" bgcolor="#E5E5E5"><div align="center"><strong>Yards Gained</strong></div></td>
    <td width="86" bgcolor="#E5E5E5"><div align="center"><strong>Ball on the</strong></div></td>
    <td width="57" bgcolor="#E5E5E5"><div align="center"><strong>Down</strong></div></td>
    <td width="89" bgcolor="#E5E5E5"><div align="center"><strong>Yards to go</strong></div></td>
  </tr>
  <tr>
    <td height="56" bgcolor="#FFFF99"><div align="center"><img src="http://powerzsoftware.com/tsn/nfl/PS/082.png" name="imgcur1" width="60" height="45" id="imgcur1"></div></td>
    <td bgcolor="#FFFF99"><div align="center" id="txtQ"></div></td>
    <td bgcolor="#FFFF99"><div align="center" id="txttime"></div></td>
    <td bgcolor="#FFFF99"><div align="center" id="txtplaytype"></div></td>
    <td bgcolor="#FFFF99"><div align="center" id="txtYdsgain"></div></td>
    <td bgcolor="#FFFF99"><div align="center" id="txtballon"></div></td>
    <td bgcolor="#FFFF99"><div align="center" id="txtdown"></div></td>
    <td bgcolor="#FFFF99"><div align="center" id="txtyards"></div></td>
  </tr>
</table>
<table width="750" height="55" border="0" class="textborder">
  <tr>
    <td bgcolor="#FFFF66"><p align="center" id="txtGametext">&nbsp;</p>
    <p>&nbsp;</p></td>
  </tr>
</table>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>Football Field with drawn lines will go here!</p>
<table width="750" border="0">
  <tr>
    <td bgcolor="#006633"><div align="center" class="title"> Play by Play Game Log</div></td>
  </tr>
</table>
<table width="750" border="0">
  <tr bgcolor="#E6E6E6" class="textborder">
    <td width="104"><strong>Team</strong></td>
    <td width="82"><strong>Quarter</strong></td>
    <td width="89"><strong>TimeLeft</strong></td>
    <td width="108"><strong>Playtype</strong></td>
    <td width="96"><strong>Yards Gained</strong></td>
    <td width="83"><strong>Ball on the</strong></td>
    <td width="61"><strong>Down</strong></td>
    <td width="93"><strong>Yards to go</strong></td>
  </tr>
</table>
<div style='height: 400px; overflow-y: scroll;'>
<table width="750" border="0" class="tablebord" id="scrolltable">
  <tr bgcolor="#FFFF99">
    <td width="106"><div align="center">
      <p><img src="http://powerzsoftware.com/tsn/nfl/PS/082.png" alt="" name="imgcur" width="60" height="45" id="imgcur2"></p>
    </div></td>
    <td width="78"><div align="center"></div></td>
    <td width="88"><div align="center"></div></td>
    <td width="109"><div align="center"></div></td>
    <td width="96"><div align="center"></div></td>
    <td width="83"><div align="center"></div></td>
    <td width="59"><div align="center"></div></td>
    <td width="89"><div align="center"></div></td>
  </tr>
  <tr>
    <td colspan="8" bgcolor="#FFFF66"><div align="center">
      <p>&nbsp;</p>
      <p>&nbsp;</p>
    </div></td>
  </tr>
</table>
<table width="750" border="0">
  <tr>
    <td><div align="center">
      <input type="submit" name="btnScore" id="btnScore" value="Scoring Plays">
      <input type="submit" name="btnCompletes" id="btnCompletes" value="Completed Passes">
      <input type="submit" name="btnCompletes2" id="btnCompletes2" value="Sacks">
      <input type="submit" name="btnCompletes3" id="btnCompletes3" value="Interceptions">
    </div></td>
  </tr>
</table>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp; </p>
<script>
var myVar=setInterval(myTimer,1000);

function myTimer()
{
	gettext();
}
  </script>
</body>
</html>

Open in new window

0
 

Author Closing Comment

by:powerztom
ID: 39624553
Tech helped me with proper syntax.
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

I found this questions asking how to do this in many different forums, so I will describe here how to implement a solution using PHP and AJAX. The logical flow for the problem should be: Write an event handler for the first drop down box to get …
Building a website can seem like a daunting task to the uninitiated but it really only requires knowledge of two basic languages: HTML and CSS.
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now