Sunday, 15 August 2010

html - Create code simplier in a separate parts -



html - Create code simplier in a separate parts -

<input type='button' class="mybutton" onclick="document.body.style.csstext+=';background-image: url(img01.jpg);background-repeat: no-repeat; -moz-background-size: cover; -o-background-size: cover; background-size: cover;';" value="sehr-gut">

is there way create code simpler? create css style , set onclick event?

you need jquery that. utilize @philtune's solution or on different approach:

<input type='button' class="mybutton" onclick="$(body).addclass('some-classname')" value="sehr-gut">

and in css

body.some-classname { background-image: url(img01.jpg); background-repeat: no-repeat; -moz-background-size: cover; -o-background-size: cover; background-size: cover; }

html css

No comments:

Post a Comment