Hi I'm new here, and trying to debug a new site I'm working on. Seems like this is a REALLY helpful forum - so maybe someone kind enough to tell me my error. The code is for a search box on an HTML/PHP site...and it's set up to have default text...and 'onclick', then it's supposed to remove the default text and let the user type their search.
However, dreamweaver is giving me huge 'Error' message, saying
<?> Invalid markup...Markup invalid because it contains a duplicate attribute.
<input...Remove the duplicate attribute
Here's the section...and I've bolded the part that Dreamweaver says has an error.
---------------
<form action="index.php" method="post"><span class="searchform">
<label></label>
</span>
<div align="right">
<input name="search" type="text" class="searchboxtext" id="search"
<?if ($search !=""){?>
value="<?=$search?>" onfocus="if(this.value == 'Style, Brand, Color, etc') {this.value = '';}" onblur="if (this.value == '') {this.value = 'Style, Brand, Color, etc';}"
<?}else{?>
value="Style, Brand, Color, etc" onfocus="if(this.value == 'Style, Brand, Color, etc') {this.value = '';}" onblur="if (this.value == '') {this.value = 'Style, Brand, Color, etc';}"
<?}?>
/>
<input type="image" src="<?=$root_http?>images/searchbutton.jpg" align="middle" /><span class="searchform"> </span></div>
</form>
-----------------
I would LOVE it if someone could help me learn what's wrong here, if you spot which attribute is duplicate...or how I can make the error go away while still doing on the 'on click' stuff. I'm trying to teach myself and some stuff is easy, but this one is tricky for me. Thank you so much.
Best,
Mike
Question on Code Error for a Search Box
Moderator: General Moderators
-
homesupplyguy
- Forum Newbie
- Posts: 1
- Joined: Tue Aug 11, 2009 3:19 pm
- aceconcepts
- DevNet Resident
- Posts: 1424
- Joined: Mon Feb 06, 2006 11:26 am
- Location: London
Re: Question on Code Error for a Search Box
Try this:
Can anyone guess where this is from?
Code: Select all
value="Search…" onclick="if(this.value=='Search…')this.value='';" onblur="if(this.value=='')this.value='Search…';"Re: Question on Code Error for a Search Box
I see it in the top right corner 
- aceconcepts
- DevNet Resident
- Posts: 1424
- Joined: Mon Feb 06, 2006 11:26 am
- Location: London
Re: Question on Code Error for a Search Box
hahaha exactly - it's closer than you think eh 