Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

General Discussion

Search Area- www.uHeadphones.Com

Hello Everyone,

So I launched my first website about a month and a half ago and when I first launched it everything was fine with the my Search Bar or "searcharea" I haven't touched the code for the header and the only person to go in was my SEO guy.

Can somebody please help me out to figure out what is wrong with my code? When I click the Search Bar to type something in it refreshes my home page. I tried going through it and could not figure it out. Below I will post the code, my site uses HTML and some JavaScript:

<div class="searcharea"> <div class="custom-search" id="ctl00_ctl02_searchBox"> <input type="text" class="textbox custom-search-field" type="text" maxlength="100" id="search-textbox" class="textbox" value="Enter keyword(s), item #, etc..." onblur="if (this.value == '') {this.value = 'Enter keyword(s), item #, etc...';} "onfocus="if (this.value == 'Enter keyword(s), item #, etc...') {this.value = '';}" /> <input type="image" class="custom-search-button" alt="Go" src="themes/default/images/btn_header_search.gif" id="search-button" name="ctl00$ctl02$go" /> </div> </div>

9 Answers

<div class="searcharea">
  <div class="custom-search" id="ctl00_ctl02_searchBox">
    <input type="text" class="textbox custom-search-field" type="text" maxlength="100" id="search-textbox" class="textbox" value="Enter keyword(s), item #, etc..." onblur="if (this.value == '') {this.value = 'Enter keyword(s), item #, etc...';} "onfocus="if (this.value == 'Enter keyword(s), item #, etc...') {this.value = '';}" /> 
    <input type="image" class="custom-search-button" alt="Go" src="themes/default/images/btn_header_search.gif" id="search-button" name="ctl00$ctl02$go" />
  </div>
</div>

Not sure if anyone can see the code I included but I tried to copy it in.

thank you

I was unable to view your code but I noticed you are using ASP to develop the website. If you are using the ASP search box, check the "AutoPostBack" property and make sure it is set to False.

Let me know if that helps,

Cody.

hmmm is using ASP bad? I had a company build the framework of the site and then I updated all of the details using an eCommerce platform. Is there a way I can send you a copy of the search code?

I can also view code of any site using Google Chrome, using the developer tool if you don't mind spending a couple of minutes.

Did you check out the site and click the search area? it is very strange to me I have checked the original code and everything, all of it seems to be normal.

Thank You for the help

I have a few minutes to spare if you would like me to look at your code. Do you have Skype?

Hey it looks like the code is showing now in my second post do you see that?

I also do not have Skype, I noticed that when you respond it is coming from help@teamtreehouse.com, I might just send an e-mail there with the code attached.

Yes. I see your code now, I'm looking over it now..btw, ASP is not a bad language to use. Looking at your code you attached to the post, I think your the HTML is not causing the issue. It has to be your Javascript causing the reload. What is your email address?

my e-mail address is Pbotwick@gmail.com.

I also have an issue with my sequence banner where if I leave the page and go to a different tab then come back to the tab minutes later it will be flashing between all of my banners. The person I had build the site said this could not be fixed which I find very strange.

Could this be throwing off my code for the search bar?

One thing you might find interesting, is the search works perfectly fine when I tried it in IE8. However all of my other browsers which are up to date, such as Chrome, Firefox, Opera and Safari are simply reloading.

So from that we know that there's probably a specification for newer browsers that's causing it. Take a look at what you've got.