PDA

View Full Version : "Remove duplicate attribute in code view"


4strinbass
10-27-2010, 10:05 PM
^ I keep getting that error with this piece of code:
<img src="images/Main_27.png" onMouseOver='changeText()' value='Change Text' onMouseOut='changeText2()' value='Change Text2' width="154" height="133" alt="" />

Can someone tell me what I'm doing wrong in there? I'll load the page in my browser and everything will work fine with that code, but in Dreamweaver the image doesnt show up and throws off all the rows and says there's an error in the code.

gentleone
10-27-2010, 10:30 PM
You have twice the value attribute while there's one allowed, so that's your error.

4strinbass
10-27-2010, 10:39 PM
You have twice the value attribute while there's one allowed, so that's your error.

Ah ok. How would go about making that image have both a mouseover andd mouseout reaction then if i cant have two values?

gentleone
10-27-2010, 10:53 PM
What do you want to achieve with the changeText behavior? Where in your page are you changing the text?

4strinbass
10-27-2010, 11:05 PM
I'm changing the text in a row. I want to hover over the image which will cause the text in the designated <p> to change to different text then when the mouse isnt over the image it will change back.

4strinbass
10-27-2010, 11:12 PM
ah i just got rid of the "value=" overall. it doesnt seem to be affecting anything and everything's pristine now.

gentleone
10-27-2010, 11:14 PM
You'll need a javascript function and use getElementById to change the value with for instance innerHTML. If you google you will find heaps of examples how to.