What I want to do is to generate a random number between and creating a button that will google it.
I am stuck on creating the button to do so.
I am using the following code to generate a random number:
<div id="random" onclick="javascript:document.getElementById('random').innerHTML = Math.floor(Math.random() * 1001);" >
How do I add functionality to a button which will Google that randomly generated number?
Right now, I am thinking on the lines of how we generate forms, which Google what the user types in them, for instance:
<form align = "center" action = "http://www.google.com/search" target="_blank">
<input name = "q"> <input type = "submit" value="Google !">
</form>
You don’t really need a form, a regular hyperlink would work just fine.
Of course, you could use an image instead of text if you want to use a graphic button, and if you’d like to use a regular form button, the following would do the trick…