Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 372
  • Last Modified:

Load two end zone Images on a football field image

I have a football field and I need to load both end zones with images I created a transparent image called blank.gif I constructed javascript/jquery code based on previous code it's not loading but Endzones for this xml file are here is home this is whqat I need to load into a Blank.gif it's like a placeholder http://images.sportsnetwork.com/nfl/atthegridiron/end_zone2/081_home.jpg

I need both endzones here is code let me know what is missing
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>The sports Network</title>
<style type="text/css">
.formatcell {
	text-align: center;
	vertical-align: top;
}
.textbox {
	font-family: "Trebuchet MS", Arial, Helvetica, sans-serif;
	font-size: x-small;
	color: #000;
	background-color: #FC6;
}
#awayendzone {
	position: absolute;
	width: 60px;
	height: 252px;
	z-index: 1;
	left: 48px;
	top: 23px;
}
#apDiv1 {
	position: absolute;
	width: 60px;
	height: 252px;
	z-index: 2;
	left: 708px;
	top: 23px;
}
</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 = 'AB-3171'; // game id only, _counter.xml will be added in the ajax call
  var counterXml = 0;

  var teamNames = {
    "079": "GIANTS",
    "068": "LIONS",
    "084": "49ERS",
    "063": "BEARS",
    "083": "CHARGERS",
    "085": "SEAHAWKS",
    "088": "REDSKINS",
    "061": "FALCONS",
    "062": "BILLS",
    "064": "BENGALS",
    "065": "RAVENS",
    "066": "COWBOYS",
    "067": "BRONCOS",
    "069": "PACKERS",
    "070": "TITANS",
    "071": "COLTS",
    "072": "CHIEFS",
    "073": "RAIDERS",
    "074": "RAMS",
    "075": "DOLPHINS",
    "076": "VIKINGS",
    "077": "PATRIOTS",
    "078": "SAINTS",
    "080": "JETS",
    "081": "EAGLES",
    "082": "STEELERS",
    "086": "CARDINALS",
    "087": "BUCS",
    "089": "PANTHERS",
    "090": "JAGUARS",
    "120": "BROWNS",
    "151": "TEXANS",
    "685": "A-F-C",
    "686": "N-F-C"
  };
 $(document).ready(function(){
    $.ajax({
      type: "GET",
      url:  xmlPath+"/"+xmlGameID+"_0.xml",
      dataType: "xml",
      success: function(data){
        var d = $(data);
        d.find('Team').each(function(i,Team){
          var team=$(Team);
          var id = team.attr("ID").toLowerCase();
          var teamname = team.attr("name");
          var homeOrAway = team.attr("vh");
          var selector1 = (homeOrAway=="A") ? '#Visitor' : '#Hometeam' ;
          var selector2 = (homeOrAway=="A") ? '#VTeamname' : '#HTeamName' ;
          
		  //$(selector1).html(teamname);
         // $(selector2).html(teamNames[id]);
		   
          
		  
        });
      }
    });
  });

  
  
        // changed all below to just use the variables that contain the text directly, as the arrays do not exist and don't seem necessary in this situation
		
		
       function loadData() {
  $.ajax({
    type: "GET",
    url:  xmlPath+"/"+xmlGameID+'_'+counterXml+".xml",
    dataType: "xml",
    success: function(data) {
      var d = $(data);
      var Play = d.find('Play');
      d.find('Team').each(function(i,Team){
        if ($(Team).attr('vh') == "A") {
          $('#imgawayEZ').attr('src', 'http://images.sportsnetwork.com/nfl/atthegridiron/end_zone2/'+$(Team).attr('ID')+"_away.jpg'");
         
		  
		 // $('#VRd').show()
		  // $('#VRtg').show()
         
        }
        if ($(Team).attr('vh') == "H") {
          $('#imghomeEZ').attr('src', 'http://images.sportsnetwork.com/nfl/atthegridiron/end_zone2/'+$(Team).attr('ID')+"_home.jpg'");
          
		  // $('#VRd').hide();
		  // $('#VRtg').hide();
		   
          
        }
      }); // each
        // changed all below to just use the variables that contain the text directly, as the arrays do not exist and don't seem necessary in this situation
     
      ++counterXml;
    }  
  }); //ajax

  }

</script>
</head>

<body>
<table width="800" border="0">
  <tr>
    <td><div>
      <div id="awayendzone"><img src="Blank.gif" name="imgawayEZ" width="60" height="252" id="imgawayEZ"></div>
    <img src="Field.fw.png" width="797" height="315">
    <div id="apDiv1"><img src="Blank.gif" name="imghomeEZ" width="60" height="252" id="imghomeEZ"></div>
    </div></td>
  </tr>
  <tr>
    <td bgcolor="#000000" class="formatcell">
    <textarea name="txtNarrative" cols="100" rows="3" class="textbox" id="txtNarrative"></textarea></td>
  </tr>
</table>
</body>
<script>
var myVar=setInterval(function(){myTimer()},1000);

function myTimer()
{

loadData();

}
</script>
</html>

Open in new window

You really only need one xml file for this to run but I'll include
If you now how to code Narrative Text in xml to show in textbox that would be greatly appreciated Just not sure how to load text into Textbox that increments I'll include 10 xml football game files so you get a idea or something to play with.
AB-3171-0.xml
AB-3171-1.xml
AB-3171-2.xml
AB-3171-3.xml
AB-3171-4.xml
AB-3171-5.xml
AB-3171-6.xml
AB-3171-7.xml
AB-3171-8.xml
AB-3171-9.xml
AB-3171-10.xml
GridIron.html
Field.fw.png
0
powerztom
Asked:
powerztom
1 Solution
 
Robert SchuttSoftware EngineerCommented:
On lines 116 and 124 there is an extra single quote near the end of the line:
+"_away.jpg'");

Open in new window

needs to be:
+"_away.jpg");

Open in new window

and same thing:
+"_home.jpg'");

Open in new window

needs to be:
+"_home.jpg");

Open in new window

That seems to be all, the rest works like a charm.
0
 
powerztomAuthor Commented:
A simple fix but it was something I didn't see Awesome Rob
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now