change background image for a button

I have 2 frames for my page upper_frame.html and lower_frame.html

in lower_frame.html I have a button with background as back.bmp , clicking on which I change the html content in upper_frame.html. I want to add code to change the background of the button after it is clicked to front.bmp.

here is my cuurent code

<html>
<head>

<SCRIPT language="JavaScript">

function change_overview()
{
parent.upper_frame.location="demo.html";
}
</script>
</head>

<body>

<button name="overview" style="background-image:url(back.bmp)" onclick="javascript:change_overview()"><font color="#FFFFFF">Product Overview</font>
</button>
</body>
</html>
jbajajAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Pratima PharandeCommented:
<button name="overview" style="background-image:url(back.bmp)" onclick="javascript:change_overview()" id="btnOverview" >
function change_overview()
{
parent.upper_frame.location="demo.html";
var elm = document.GetElementById("btnOverview");
elm.style.background-image = "url(front.bmp)"
}
ZvonkoSystems architectCommented:
I would change it to this:

<input type="button" name="overview" style="background-image:url(back.bmp)" onclick="changeOverview(this)" >

<!-- remove </button>

function changeOverview(theBtn){
  parent.upper_frame.location="demo.html";
  theBtn.style.backgroundImage = "url(front.bmp)"; // no dash, Uppercase letter.
}




Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
ZvonkoSystems architectCommented:
The comment http:#20175514 contains a commen wrong assumption about syntax of style attributes in JavaScript. Therefore I would not add that comment to PAQ to increase the confusion.
My proposal:

Accept:  Zvonko {http:#20175714}


Computer101Commented:
Forced accept.

Computer101
EE Admin
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Development

From novice to tech pro — start learning today.