loriensleafs
loriensleafs

Reputation: 2255

simple onclick NOT inline

I'm using interwoven's teamsite, I'm trying to figure out how to use some javascript with it, what I'm trying to do is a simple onlick function, where you click one div and it changes the background color of another div. I don't want to use jquery for this. I have a jsfiddle here http://jsfiddle.net/yeYZm/1/ and the script I tried was:

<script type="text/javascript">
function changeColor (){
btn_div.onClick= changed_div.style.backgroundColor = '#242424';
}
</script>

any help would be greatly appreciated, thanks.

Upvotes: 1

Views: 1380

Answers (1)

Trond Hatlen
Trond Hatlen

Reputation: 571

After looking at the doodle.

document.getElementById('btn_div').onclick = function () {
    document.getElementById('changed_div').style.backgroundColor = '#242424';
}

And the doodle link jsfiddle

Upvotes: 1

Related Questions