SunQuest
           HTML Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsWeb DesignHTML Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old May 26th, 2000, 12:52 PM
lawtry lawtry is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2000
Posts: 1 lawtry User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
im just trying to make a simple tictactoe game where on the click in the table, it calls a function that evaluates the current image in the table. if it is empty, it changes the gif depending on whos turn it is. if it has already been selected, it does nothing. the last argumentis a numeric argument depending upon its position in the 3x3 grid. i want to take this number and use it as an index for an array so i can evaluate the array to see if the winning conditions have been met. im a c programmer who just started doing webpages and javascript has been pretty easy up to this point. any help would be much appreciated.

here's my code:

//a calling in the body of the html<td><a href="#" onMouseOver="window.status='Go Here?'; return true" onClick="changeImages('image1', 'imagex', 'imageo', '1')"><img src="blank.gif" border="0" alt="" name="image1"></a></td>

// the function that evaluates it
function changeImages() {
if (document.images) {
for (var i=0; i<changeImages.arguments.length; i+=3) {
if(( document[changeImages.arguments[i]].src != eval(changeImages.arguments[i+1] + ".src")) && ( document[changeImages.arguments[i]].src != eval(changeImages.arguments[i+2] + ".src"))){
if( turn == 1 ){
document[changeImages.arguments[i]].src = eval(changeImages.arguments[i+1] + ".src");
//this is the code im trying to use to put the values in the array
x[document[changeImages.arguments[3]] = "x";
//here i would have the 9 conditionalstatements and redirect to the winning page if condititons are met
turn = 2;
break;
} else if( turn == 2 ){
document[changeImages.arguments[i]].src = eval(changeImages.arguments[i+2] + ".src");
//i would have the same thing in here but for the y array
turn = 1;
break;
}
}
}
}
}


Reply With Quote
Reply

Viewing: Dev Shed ForumsWeb DesignHTML Programming > problem passing arguments


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway