PDA

View Full Version : why is duplicate attribute bad?


jetskiron
02-26-2008, 09:11 PM
I could not find a definition of "duplicate attribute" in DW6 help. What is an attribute, anything inside "<>"?

Is duplicate attribute necessarily bad? Why?

I got the DW properties "invalid markup" for "duplicate attribute" in the following tag:

<tr <% If i Mod 2 = 1 Then %> bgcolor="#eeeeee" <% Else %> bgcolor="#ffffff" <% End If %>>

What exactly is the duplicate attribute here, "bgcolor=..."?

This code comes from my Peoples Choice page at insurance-claims-questions.com.

thanks,
Ron

Rob_Che
02-26-2008, 09:33 PM
Hey jetskiron...

Is it not because you've got <>'s inside more <>'s without closing them ?


...but this really isn't my area... I'm stil trying to find my 'area'...

davidj
02-26-2008, 09:37 PM
yes bgcolor is the duplicate

its a bad example of code. What i would do is define the color style or class in an IF condition and return the value (#ffffff or class) inside the bgcolor="" attribute

davidj
02-26-2008, 09:40 PM
nicley spotted rob

this is why its falling over

you need to balance your tag brackets but i would use my example above

Rob_Che
02-26-2008, 09:51 PM
Wow this place is friendly...

jetskiron
02-26-2008, 10:56 PM
Ok thanks. Can you show me exactly what it would look like. I'm afraid I'm a real newbie.

From this:
<tr <% If i Mod 2 = 1 Then %> bgcolor="#eeeeee" <% Else %> bgcolor="#ffffff" <% End If %>>

To this:



thanks,
Ron

davidj
02-26-2008, 11:02 PM
I'm not an ASP guy so what i write is just an example of pseudo code

<tr bgcolor="<% If i Mod 2 = 1 Then %>#eeeeee <% Else %>#ffffff <% End If %>" >

jetskiron
02-27-2008, 05:37 PM
Thank you very much!

I'll try that and see how it works.