DevSnips.com Code Snippet Repository
search:    


Navigation
  Home
About
Library
Contact
 
Snippet Library
  ColdFusion   338  
  ASP   201  
  PHP   101  
  HTML   11  
  JavaScript   77  
  XML   2  
  CSS   5  
  SQL   13  
  JSP   2  
  C#   1  
  ASP.NET   0  
  Submit a Code Snippet
 
Blog Archive
  September 2007
August 2007
July 2007
June 2007
May 2007
November 2006
October 2006
Search Archives
 
Random Affiliates
  Uno-Code
Tom Morris
BioMetric Base
PHP Arch

Want to become an affiliate?
Read more...


Privacy Policy
© 2008

Blog Archive

 
Simple JavaScript/eBay search form

There are multiple ways to utilize search for eBay auctions. One of the most popular ways is to utilize eBay's API to do look ups, then you would return the results and add flexible desination rover links to it. You can learn more by clicking this link for connecting to eBay's API for real time results.

Another option is to use eBay's editor kit, but this might not be ideal, since controllability is minimized with the editor kit. Let's say you wanted to create a your own HTML search forms that would take search criteria input and direct the user to the eBay's search result page? You can still maintain rover tracking with some simple javascript.

This solution will send the user to eBay's search result page. If you want to display the result on your page, you'll need to explore the API, or optionally the eBay RSS handling. Either case will involve serverside language (eg: PHP, ASP, etc). If you're looking for a simple HTML/JavaScript solution, then here is my example below:


<script language="javascript">
	function doSearch(frm){
		var pid			= '1231323';	// your CJ PID
		var aid			= '5463217';	// flex destination tool
		var catid		= '50128'; 		// baseball penants
		if(frm.SearchCriteria.value.length > 0){
			var criteria = frm.SearchCriteria.value;
			var url		= 'http://rover.ebay.com/rover/1/711-1751-2978-71/1?AID=' + aid + '&PID='+ pid + '&mpre=http%3A%2F%2Fsearch.ebay.com%2Fsearch%2Fsearch.dll%3Fsofocus%3Dbs%26sbrftog%3D1%26catref%3DC6%26from%3DR10%26satitle%3D' + criteria + '%26sacat%3D' + catid + '%2526catref%253DC6%26sargn%3D-1%2526saslc%253D2%26sadis%3D200%26sabfmts%3D1%26saobfmts%3Dinsif%26ftrt%3D1%26ftrv%3D1%26saprclo%3D%26saprchi%3D%26fsop%3D2%2526fsoo%253D2%26coaction%3Dcompare%26copagenum%3D1%26coentrypage%3Dsearch';
			window.open(url,'auction','');
		}else{
			alert("Search criteria is required");
			frm.SearchCriteria.focus();
			return false;
		}
	}
</script>
<form action="#" name="SearchForm" onSubmit="return doSearch(SearchForm);" method="post">
Search:<input type="text" name="SearchCriteria" value="">&nbsp;<input type="submit" value="Search">
</form>

What this code does is create a simple form that expects search criteria input. Once the user submits the form, the doSearch() function is called. In that function we are storing local aid, pid and catid variables that we use to assemble our flexible destination link. Finally, after the link is built, we execute the window.open() method to open the results in a new window.

For those of you unfamiliar with rover code. Rover is the server used for affiliate tracking.


Submitted on 08/04/07 at 1:23PM
Post Comment | Comments: 0
Bookmark to:
Add 'Simple JavaScript/eBay search form' to Del.icio.us Add 'Simple JavaScript/eBay search form' to digg Add 'Simple JavaScript/eBay search form' to FURL Add 'Simple JavaScript/eBay search form' to blinklist Add 'Simple JavaScript/eBay search form' to reddit Add 'Simple JavaScript/eBay search form' to Feed Me Links Add 'Simple JavaScript/eBay search form' to Technorati Add 'Simple JavaScript/eBay search form' to Yahoo My Web Add 'Simple JavaScript/eBay search form' to Newsvine Add 'Simple JavaScript/eBay search form' to Socializer Add 'Simple JavaScript/eBay search form' to Ma.gnolia Add 'Simple JavaScript/eBay search form' to Stumble Upon Add 'Simple JavaScript/eBay search form' to Google Bookmarks Add 'Simple JavaScript/eBay search form' to RawSugar Add 'Simple JavaScript/eBay search form' to Squidoo Add 'Simple JavaScript/eBay search form' to Spurl Add 'Simple JavaScript/eBay search form' to BlinkBits Add 'Simple JavaScript/eBay search form' to Netvouz Add 'Simple JavaScript/eBay search form' to Rojo Add 'Simple JavaScript/eBay search form' to Blogmarks Add 'Simple JavaScript/eBay search form' to Shadows Add 'Simple JavaScript/eBay search form' to Simpy Add 'Simple JavaScript/eBay search form' to Co.mments Add 'Simple JavaScript/eBay search form' to Scuttle

Go Back








Advertisements

GoToMeeting - Online Meetings Made Easy