Jump to content

Search Bar is refreshing to Index Page


uHeadphones.Com

Recommended Posts

Hi All, I am having issues with my search bar on my website www.uHeadphones.Com. When I click the search bar to input a keyword or anything it is refreshing my index page. If I am on my product page it is refreshing back to my index page. Pretty much it is acting as my logo button in the top left of the header. Can someone please help me out with this. I can't figure out what is wrong with the code. I am decent with HTML but not so great with JavaScript. Below I am going to post my header HTML code as with as my script.js JavaScript code. HTML in Header: actual search bar code in red <!-- START HEADER --><script type="text/javascript" src="themes/default/inc/scripts.js"></script><script type="text/javascript" src="themes/default/inc/jquery.megamenu.js"></script><script language="JavaScript" src="https://seal.networksolutions.com/siteseal/javascript/siteseal.js" type="text/javascript"></script> <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> JavaScript: Script.JS file:jQuery(function(){ var SelfLocation = window.location.href.split('?'); switch (SelfLocation[1]) { case "justify_right": jQuery(".megamenu").megamenu({ 'justify':'right' }); break; case "justify_left": default: jQuery(".megamenu").megamenu(); } }); function loadSearch() { var searchText = document.getElementById("search-textbox"); var searchButton = document.getElementById("search-button"); searchButton.onclick = function() { if (searchText.value != '') { window.location = '/search.aspx?find=' + encodeURIComponent(searchText.value).replace(/%20/g, '+'); return false; } };} MC.addLoadEvent(loadSearch);// Start Simple Text Popup//(function($){// $.fn.scSimpleText = function(options){ // var defaults = { // popCloseTxt : '' // }; //var settings = $.extend({},defaults,options); //return this.each(function(){ // var nextElm = $(this).next(); // var closeElement = $(document.createElement("a")).attr("href","").text(settings.popCloseTxt).addClass("scSimpleTextClose").click(function(e){nextElm.fadeOut("slow"); e.preventDefault();}); //$(this).click(function(e){ // nextElm.fadeIn("slow"); //nextElm.append(closeElement); // e.preventDefault(); // }); // });// }// End Simple Text Popup /**********************************************************************************************************//****************************** Place all add on JS above here, please minify *****************************//**********************************************************************************************************/ /************************************* Document on Load jQuery Functions **********************************/ jQuery(document).ready(function() { // simple text popup for privacy link // $("#simpleTextLink").scSimpleText({popClose:".simpleTextRight"});

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...