Hi forum,
I am new to javascript but have been using java for quite a while.
I am looking to make a random quote (out of ten possible quotes) appear in my h2 tag in a page i am working on. In java, i would make a random number generator, in javascript it looks like this:
Code:
var randomnumber=Math.floor(Math.random()*11)
Then make an if statement:
Code:
if randomnumber=1 {
var quote="Live long and prosper"
}
document.write(var quote);
Could someone more experienced than me tell me if my code looks good and how would a go about getting "var quote" in my h2 tag?
Thanks in advance.