Connecting Javascript with HTML !!!!



Cat fighter 2

~ OBJECT VERSION ~ Differences: when dealing with functions(in this case, the function i am talking about is called "JSobject"), variables that went through connected to one object as opposed to one/multiple arguments, meaning you must have the name of the object followed by a dot when plugging in any variable identified within the js page. Besides Function object "JSobject", "var" objects -{x}- were used in place of the one list of MyFunctions on the non-object version. With the object written, and the object variable identified another function is written that was used in non-object cat fighter, only with no strings and arrays attavhed; only the name of the earlier identified objects. then the name of the Myfunction is called in the body through a peice called "onload".

In this battle simulator I have worked with randomizing image arrays and attaching name ids to the specific images within the array. Math.floor was essential for keeping the images developing within the array numbers. randomNum was the variable used as the randomizer. myFn was used to link the javascript to the html elements.

Your Fighters




hero 1
hero 2
hero 3

Your Opponents


cat
cat
cat






Did you win?