Go Back   MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Dec 29, 2006, 02:34 AM   #1
LtRammstein
macrumors 6502a
 
Join Date: Jun 2006
Location: Denver, CO
Send a message via AIM to LtRammstein Send a message via MSN to LtRammstein
JavaScript help (Spry is involved!)

Okay, I'm hosting this Bowl Pick Challenge and I'm trying to make it so it automates the points, problem is JavaScript (and I believe Spry too) is acting up in a way where it will do a self document.write() and display 1000!

Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head xmlns="http://www.w3.org/1999/xhtml" xmlns:spry="http://ns.adobe.com/spry/" >
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<title>Other Predictions</title>
<script type="text/javascript" src="includes/xpath.js"></script>
<script type="text/javascript" src="includes/SpryData.js"></script>
<script type="text/javascript" src="includes/SpryEffects.js"></script>
<script type="text/javascript">
	var dsBowlGame = new Spry.Data.XMLDataSet("bowlgames.xml", "bowlgames/game", {useCache:true});
	//dsBowlGame.loadData();
	function count(name,outcome) {
		var x = 0;
		if(name == outcome) {
			x = x + 1;
		} else {
			x= x + 0;
		}
		return x;
	}
	
	function total(x) {
		var t = 0
		t += x;
		return x;
	}
</script>
<style type="text/css">
<!--
body,td,th {
	font-family: Times New Roman, Times, serif;
	font-size: 14px;
	color: #FFFFFF;
}
body {
	background-color: #333333;
	margin-left: 5px;
	margin-top: 5px;
	margin-right: 5px;
	margin-bottom: 5px;
}
a:link {
	color: #FFFF00;
}
a:visited {
	color: #FFFFFF;
}

.odd {
	background-color:#666666;
}

.win {
	font-family: Times New Roman, Times, serif;
	font-size: 14px;
	color: #00FF00;

}

.lose {
	font-family: Times New Roman, Times, serif;
	font-size: 14px;
	color: #FF0000;

}
-->
</style></head>
<body onload="javascript:Spry.Effect.AppearFade('1', {duration:3000,from:0,to:100,toggle:false});" alink="#FFFF00" vlink="#FFFFFF">
Below are the bowl picks tha people have picked. I have gotten the code written so that <span style="color:#00FF00">Wins</span> and <span style="color:#FF0000">Losses</span> are their respective colors. Enjoy seeing people's picks! Wanna see what the experts picked? Go <a href="http://www.sportsline.com/collegefootball/expertpicks" target="_blank">here</a> to find out! </p>
<div align="left" spry:detailregion="dsBowlGame" style="opacity:0.0; filter:alpha(opacity=0)" id="1">
<table width="100%" border="1" cellpadding="1" cellspacing="0" bordercolor="#000000" align="center">
    <tr>
      <th width="3%" onclick="dsBowlGame.sort('@id');">#</th>
	  <th onclick="dsBowlGame.sort('steve');">Steve's Pick</th>
	  <th onclick="dsBowlGame.sort('brandon');">Brandon's Pick</th>
	  <th onclick="dsBowlGame.sort('gabe');">Gabe's Pick</th>
	  <th onclick="dsBowlGame.sort('kevin');">Kevin's Pick</th>
	  <th onclick="dsBowlGame.sort('rem');">Rem's Pick</th>
    </tr>
    <tr spry:repeat="dsBowlGame" spry:odd="odd">
      <td align="center">{@id}</td>
	  <td align="center">
	  	<div spry:choose="spry:choose">
			<div spry:when="'{steve}' == '{winner}'" class="win">{steve}</div>
			<div spry:when="'{winner}' == ' '">{steve}</div>
			<div spry:when="'{steve}' != '{winner}' && '{winner}' != ' '" class="lose">{steve}</div>
			<div spry:default="spry:default">{steve}</div>
		</div>  
	  </td>
	  <td align="center">
	  	<div spry:choose="spry:choose">
			<div spry:when="'{brandon}' == '{winner}'" class="win">{brandon}</div>
			<div spry:when="'{winner}' == ' '">{brandon}</div>
			<div spry:when="'{brandon}' != '{winner}' && '{winner}' != ' '" class="lose">{brandon}</div>
			<div spry:default="spry:default">{brandon}</div>
		</div>
      </td>
	   <td align="center">
	  	<div spry:choose="spry:choose">
			<div spry:when="'{gabe}' == '{winner}'" class="win">{gabe}</div>
			<div spry:when="'{winner}' == ' '">{gabe}</div>
			<div spry:when="'{gabe}' != '{winner}' && '{winner}' != ' '" class="lose">{gabe}</div>
			<div spry:default="spry:default">{gabe}</div>
		</div>
	   </td>
	   <td align="center">
	  	<div spry:choose="spry:choose">
			<div spry:when="'{kevin}' == '{winner}'" class="win">{kevin}</div>
			<div spry:when="'{winner}' == ' '">{kevin}</div>
			<div spry:when="'{kevin}' != '{winner}' && '{winner}' != ' '" class="lose">{kevin}</div>
			<div spry:default="spry:default">{kevin}</div>
		</div>
	   </td>
	   <td align="center">
	  	<div spry:choose="spry:choose">
			<div spry:when="'{rem}' == '{winner}'" class="win">{rem}</div>
			<div spry:when="'{winner}' == ' '">{rem}</div>
			<div spry:when="'{rem}' != '{winner}' && '{winner}' != ' '" class="lose">{rem}</div>
			<div spry:default="spry:default">{rem}</div>
		</div>
	   </td>
    </tr>
	<tr>
		<td>
			<div>Total:</div>
		</td>
		<td id="steve" align="center">
			<div style="visibility:hidden">
				<script language="javascript">
					document.getElementById("steve").innerHTML = total(count('{steve}','{winner}'));
				</script>
			</div>
		</td>
		<!--<td>
			<div>
				<script language="javascript">
					document.write(count('{brandon}','{winner}'));
				</script>
			</div>
		</td>
		<td>
			<div>
				<script language="javascript">
					document.write(count('{gabe}','{winner}'));
				</script>
			</div>
		</td>
		<td>
			<div>
				<script language="javascript">
					document.write(count('{kevin}','{winner}'));
				</script>
			</div>
		</td>
		<td>
			<div>
				<script language="javascript">
					document.write(count('{rem}','{winner}'));
				</script>
			</div>
		</td>-->
	</tr>
  </table>
</div>
</body>
</html>
What will happen is that the page will display but it will continually load so it's impossible to do anything! Any suggestions or helps on what I'm doing wrong?

Steve
__________________
17" White Intel iMac 1.83GHz, 250 GB HD, 2 GB RAM || iPod Touch 16GB w/ 3.0 || 15" Intel MBP 2.4GHz, 250 GB HD, 4 GB RAM
LtRammstein is offline   0 Reply With Quote
Old Dec 29, 2006, 04:11 AM   #2
LtRammstein
Thread Starter
macrumors 6502a
 
Join Date: Jun 2006
Location: Denver, CO
Send a message via AIM to LtRammstein Send a message via MSN to LtRammstein
I have reached a solution... Not the best in the world, but it works.

http://www.sigmanuepsilondelta.com/predict.html

This will do (if you view the source). Any suggestions on making it better, I'll gladly take into consideration!
__________________
17" White Intel iMac 1.83GHz, 250 GB HD, 2 GB RAM || iPod Touch 16GB w/ 3.0 || 15" Intel MBP 2.4GHz, 250 GB HD, 4 GB RAM
LtRammstein is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Similar Threads
thread Thread Starter Forum Replies Last Post
Best Way to Use Windows On A Mac (Particular Question Involved) xShane Mac Basics and Help 5 Jan 9, 2013 01:47 AM
Spry Accordion - Thumbnail Portfolio ContentPanel Height Teleportable Web Design and Development 3 Nov 1, 2012 07:25 PM
Was Steve really involved with the iPhone 5? Starfyre iPhone 4 Sep 12, 2012 02:50 PM

Forum Jump

All times are GMT -5. The time now is 09:11 PM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC