Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
Kilson
Jan 16, 2003

I EAT LITTLE CHILDREN FOR BREAKFAST !!11!!1!!!!111!

Citanu541 posted:

but the part that I just can't figure out is that he wants us to display each roll separated by a comma and stick "and" between the second to last and last numbers. (example: 4, 6, 3, 6, and 4) Which stills sounds simple until he tells us we can't use arrays to complete the task! I have to be honest with the fact that I don't know how to do this with out arrays! I'm too used to using them at this point in my life. Really we're limited to loops and if statements. If anybody has any insight on how I can go about doing this I'd appreciate it.

code:
	for(counter = 1; counter <= diceNum; counter++)
		{
		var random = (Math.floor(Math.random() * 7) + 1);
		
		alert("Dice # " + counter + ": " + random);
		total = random + total;		
		document.write("" + random + ", ");
		
		}

Just change the last line of that for loop to something like this:
code:
if (counter == diceNum) {
  <some document.write() statement>
} else {
  <some other document.write() statement>
}

Adbot
ADBOT LOVES YOU

Kilson
Jan 16, 2003

I EAT LITTLE CHILDREN FOR BREAKFAST !!11!!1!!!!111!

Ether Frenzy posted:

I'm having trouble amending this javascript form submission to also allow the "Enter" key to submit the form. I'm not that experienced with javascript, so my googling has not been resulting in any successes at inserting the additional elements.

Shouldn't it work just to make your input button type="submit"?

Kilson
Jan 16, 2003

I EAT LITTLE CHILDREN FOR BREAKFAST !!11!!1!!!!111!

Jose Cuervo posted:

I downloaded the four js files and placed them in my www folder and things work just fine now. One quick question though. In the byzoomer_demo.js file it looks like all I need from there is the initialization of the object (new ByZoomer();). Is there any way for me to make this initialization happen by writing the code in my webpage (say in the <head> section?

You can just put something similar to this:

code:
<script type="text/javascript">
 var zoomer = new ByZoomer();
</script>

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply