mercredi 2 mars 2016

Javascript RGB Values

I'm trying to create three fields where by the RGB value entered in each of the fields are then used to change the background colour of my text area. I also need to check that they are valid numbers being entered in the field. So far I have set up the fields:

html:

<form name="RGB">
<p>Red Value<input name="red" type="text"></p>
<p>Green Value<input name="green" type="text"></p>
<p>Blue Value<input name="blue" type="text"></p>
<input name="submit" type="button" value="Submit" onclick="changeBackground();">

Now for the javascript I know it would start with

function changeBackground(){

and that I would need some form of if statement to check the values however I am not sure how to implement this.

Aucun commentaire:

Enregistrer un commentaire