...

View Full Version : Edit styles with input?



pxlcreations
02-05-2011, 03:36 AM
Is there any way that I can have multiple textboxes where the user can enter text (such as "black or green") and it would edit a css file, like this:


<style>
body{
background-color:INPUT;
}
</style>

<input type="text" name="bg"/>

?

oVTech
02-05-2011, 04:54 AM
I don't know that you can change the actual stylesheet with JS, but you can override it with a simple inline statement such as:


<input type="text" name="bgChange" value="" onblur="document.body.style.backgroundColor = this.value;" />


It would be better writing a function though because then you can override a bunch of styles at the same time.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum