- This topic is empty.
Viewing 3 posts - 1 through 3 (of 3 total)
Viewing 3 posts - 1 through 3 (of 3 total)
- The forum ‘JavaScript’ is closed to new topics and replies.
The forums ran from 2008-2020 and are now closed and viewable here as an archive.
Home › Forums › JavaScript › Change the style of an element using JS
Hello!
I have a question that will probably seem really simple but I don’t really no how to use JavaScript so have no idea…
What i would like to do would be that when people click inside an input box to start typing, the hole div holding that box changes colour to something set buy me, this is the layout so far…
___________styling__________
.normal
{
background-color:gray;
}.focus
{
background-color:white;
}
#contactbox1{
height: 100px;
}
______styling_____________
_____HTML____________
<div id="contactbox1" class="normal">
<input type="text" size="40" class="normal" onfocus="this.className=’focus’" onblur="this.className=’normal’" />
</div>
_____HTML___________
That will change the colour of the input box… but I want to change background colour of the div="contactbox1" Any ideas?
(Does anybody no a good place to learn lots of JavaScript from scratch… Videos would be good as I’m deferentially a visual learner, that’s why I love the CSS-Tricks videos on itunes!)
Regards
This should get you started http://blog.themeforest.net/screencasts/jquery-for-absolute-beginners-video-series/
Thanks for that! That will defiantly help (I need to learn this to be able to do a lots of things lol)! :-)