|
Note: as document.write writes to the document stream, calling document.write on a closed (loaded) document automatically calls document.open, which will clear the document.
Likely, you want to manipulate the DOM rather than rewrite the document.
jQuery makes that a lot easier than the native DOM API, but you may not be able to use that for this assignment (it is an assignment, right?)
Secondly, the reason for the double click needed is that you aren't setting up the click handler for the images until a window click hander is executed. Why? I'm having a hard time figuring out what you are trying to accomplish with that.
You locate an image element in the DOM and store it in a variable named click. That's really confusing later on. It's an image element that represents a card, right? So name it card, or cardImage, or something that represents what it is.
Ryan O'Neill wrote:
It is an assignment, and if jQuery is something that is easy to pickup I would be more than willing to learn it.
Can I just get rid of one or the other? Is there a preferred way to handle a click?
That is a good point. I'll change it so it is much easier to read for my prof myself and really everyone. Thanks
I have changed my method so that it is isAddT(x,x); which makes much more sense.
That greatly depends on what is you wan to be clickable. I assume you want to do something with a card when it is clicked. Ergo, you should have a click handler on the cards. I don't know what the purpose of the window-level click handler was supped to be, and I can't think of any possible reason for it.
Ryan O'Neill wrote:Any help with this loop would be a big help. I can't get it to go into the first if.
Ryan O'Neill wrote:I cannot for the life of me figure out why the 2nd card doesn't flip when isAddTrue is true.
Ryan O'Neill wrote:I cannot for the life of me figure out why the 2nd card doesn't flip when isAddTrue is true.
This looks like a job for .... legal tender! It says so right in this tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
|