Moving on javascript random pick and collapsable div

One of the first javascripts I have planned to use was random pick. Code for this kind of function was found on website:

This javascript was working properly on and off for some reason. But on the top of it, after going back from game page to home page useing home btn, javascript failed to load as this example doesnt work in a loop.

Different code was find on website:

After implementing this new code:

function randomGame(){
var myrandom=Math.round(Math.random()*9)
var link1=”game1.html”
var link2=”game2.html”
var link3=”game3.html”
var link4=”game4.html”
var link5=”game5.html”
var link6=”game6.html”
var link7=”game7.html”
var link8=”game8.html”
var link9=”game9.html”
var link10=”game10.html”
if (myrandom==0)
else if (myrandom==1)
else if (myrandom==2)
else if (myrandom==3)
else if (myrandom==4)
else if (myrandom==5)
else if (myrandom==6)
else if (myrandom==7)
else if (myrandom==8)
else if (myrandom==9)

Second function I wanted to implement in one of the game rules was collapsable div.  There is many jQuery with this function, so why do I have to look for simple javascript?

Answer is simple, as jquery should be used in web browsing only, not in app development. Phone runs on different software and hasn’t got that powerfull hardware as PC or Mac.

I was also consider useing just pure CSS3 to achieve this as I came a croos this tutorial:

Code seem to be very long and complicated for such a small function so to the end I have decided to use one of the javascripts from my library:


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: