RSS

BUY Vermox ONLINE NO PRESCRIPTION

BUY Vermox ONLINE NO PRESCRIPTION, OS X has a lot of great effects. These are great building blocks for creating effects for the web. You might have seen my previous tutorial on creating a Dashboard-Like effect using JS and CSS. This tutorial will show you how to create a Spotlight-Like effect for your search boxes. Take a look at the picture to the right to see where we are headed:

You can preview the finished effect here. This example will search through 3 text files of lists of names of celebrities, athletes, and presidents, BUY Vermox ONLINE NO PRESCRIPTION. In most real world situations, Vermox 125mg, you would be searching inside databases, but for this preview I used text files. I have also zipped up the necessary files and put them here. This zip contains all required images, Vermox over the counter, CSS files, HTML files, and javascript files.

spotlight_search.png

What we need to do



  • Create the HTML markup

  • Style a bit with CSS

  • Write our Javascript code

  • Write the PHP code to return the search results

  • Finish up the CSS

  • Tie everything together


I should note here that we are going to use PHP, but any scripting language will do.

Create the HTML markup

BUY Vermox ONLINE NO PRESCRIPTION, We're first going to start by laying out our HTML. This is a really simple step, where can i order Vermox without prescription. Inside your head tag, put:



You might notice that we are using script.aculo.us. We are including those libraries so we can get a few nice animation effects. If you do no want these effects (more info in the JS section), Vermox samples, you don't need to include lines 1 and 2. Note: On line 2, the source also specifies to only load the effects.js file, BUY Vermox ONLINE NO PRESCRIPTION.

Line 3 points to our javascript file. Line 4 points to our CSS file. Simple right. Next place the following code somewhere inside your body tag:






Start typing. Your results will show below instantly.
BUY Vermox ONLINE NO PRESCRIPTION, This is the code that does a few things. It creates a search box, where can i buy Vermox online, q, which has an event handler, onkeyup, that calls our doSearch() method. Jacksonville, Florida, Columbus, Ohio, We then create an image that has the onclick method set to the same action. We need to return false here so that the form's action is not called.

The next div is where the search results will come back. Right now I have some text in there that tells people to just type and see results, BUY Vermox ONLINE NO PRESCRIPTION. You could have also left it blank if you don't want there to be anything before users type.

That's it for our HTML. Very, Vermox from canadian pharmacy, very, very simple. Let's move onto the CSS so we can style this HTML nicely.

Style a bit with CSS

BUY Vermox ONLINE NO PRESCRIPTION, I've broken the discussion of the CSS file up into two parts. We will talk about the second portion in just a bit. Vermox 500mg, The full CSS file is available in the zip file. In this first part, we are just going to style the HTML we've written so far. Not any of the search results. This section contains only 3 things:
a img {
border: 0px;
}
form#search_form input {
vertical-align:middle;
display:inline;
}
form#search_form #search_image {
margin-left: -15px;
}

Like our HTML, this is very simple, BUY Vermox ONLINE NO PRESCRIPTION. The a img just makes sure we don't draw a border around images inside links. Next, Vermox 150mg, we make sure all of our form elements are lined up. We also make the search icon have a left margin of -15 pixels. This will make our search icon overlap with the text box. BUY Vermox ONLINE NO PRESCRIPTION, We're all done with the CSS for now. Let's move onto the Javascript. Vermox 800mg, 875mg, 900mg,

Write our Javascript code


Let's analyze our JS code a bit. This first part creates a typical XMLHttpRequest and creates a few helper methods for it.
function createRequestObject() {
var ro;
var browser = navigator.appName;
if(browser == "Microsoft Internet Explorer"){
ro = new ActiveXObject("Microsoft.XMLHTTP");
}else{
ro = new XMLHttpRequest();
}
return ro;
}
var http = createRequestObject();
function sndReq(action) {
http.open('get', action);
http.onreadystatechange = handleResponse;
http.send(null);
}
function handleResponse() {
if(http.readyState == 4){
document.getElementById('searchResultsDiv').innerHTML = http.responseText;
}
}

I'm not going to spend time explaining the workings of these AJAX objects. There are tutorials better at that, BUY Vermox ONLINE NO PRESCRIPTION. I'll just say that we will use the method sndReq to send asynchronous requests with action as the URL we want to request. The function handleResponse will be called when the AJAX request is done, Vermox for sale. When we receive the finished request, we set the innerHTML of our search results div with the response text. Next we have our doSearch and openWindow functions:
function doSearch() {
var val = 'do_search.php?q=' + document.getElementById('q').value;
sndReq(val);
return false;
}
function openWindow(url) {
window.open(url,'popupWindow', Buy Vermox without prescription, 'resizable=no, scrollbars=yes, toolbar=no, status=no, height=650, width=720');
}

doSearch() will send an AJAX request to do_search.php with the q variable set to the search box's value, Vermox coupon. openWindow() BUY Vermox ONLINE NO PRESCRIPTION, will simply open a new window and go to a certain URL. This code is executed when an item from the search results is clicked. You can change this function to do whatever you wish when your search results are clicked. Finally, we have the following javascript code:
function expandOrClose(arrow_id, Kjøpe Vermox online, bestill Vermox online, list_num, list_name)  {
var a = document.getElementById(arrow_id);
if(a.name=='d') {
a.src='arrowRight.gif';
a.name='r';
hideSearchTypes(list_num,list_name);
}
else {
a.src='arrowDown.gif';
a.name='d';
showSearchTypes(list_num,list_name);
}
return false;
}
function hideSearchTypes (i,j) {
var theDiv = document.getElementById(j).getElementsByTagName('li');
for(var d = 1; d < theDiv.length; d++) {
var theID = 'res-'+i+'-'+d;
Effect.DropOut(theID);
}
}
function showSearchTypes (i,j) {
var theDiv = document.getElementById(j).getElementsByTagName('li');
for(var d = 1; d < theDiv.length; d++) {
var theID = 'res-'+i+'-'+d;
Effect.Appear(theID);
}
}

expandOrClose() is called when a user clicks on a category heading (the blue sections in the image above), online buying Vermox. What we want to do is compress that section so it takes up no space. Our JS code simply changes the arrow direction and then calls one of the next two functions, BUY Vermox ONLINE NO PRESCRIPTION. The two functions go through each remaining row in that category and hide/show it. These two functions use the script.aculo.us effects. You could also just do something like:
function hideSearchTypes (i, New York. Los Angeles, California, j) {
var theDiv = document.getElementById(j).getElementsByTagName('li');
for(var d = 1; d < theDiv.length; d++) {
var theID = 'res-'+i+'-'+d;
document.getElementById(theID).style.display = 'none';
}
}
function showSearchTypes (i,j) {
var theDiv = document.getElementById(j).getElementsByTagName('li');
for(var d = 1; d < theDiv.length; d++) {
var theID = 'res-'+i+'-'+d;
document.getElementById(theID).style.display = '';
}
}

That code immediately hides or shows each row. It also does not require the two script.aculo.us libraries. BUY Vermox ONLINE NO PRESCRIPTION, That looks about it for the javascript code. Let's move onto our PHP code.

Write the PHP code to return the search results


I want to repeat that this does not require PHP. Any language will do, Indianapolis, Indiana, San Francisco, California. Perl, ASP, Python, etc. I use PHP, so that is what this tutorial will use, but the rest of the code is independent of what language you use, BUY Vermox ONLINE NO PRESCRIPTION. Reasons to buy Vermox online, We'll start with the first bit of PHP code:

This will set the variable $q to the value from our request. Be sure to make any proper permission checks here. For instance, you may want to confirm that the user has logged in or escape the strings to prevent any hacking.

I am going to start out with what your PHP should print out. Here is an example:





Surround your output in a div with id as search_results. Each category of results you make will be its own ul, where can i find Vermox online. Give it a unique ID and make its class search_results_list. Each ul should have one li with class="searchHeader". Inside that li, we make a link, Farmacia Vermox baratos, Vermox online kaufen, which calls our javascript function expandOrClose(). We put the arrow image, and then we write the title of the category, in this case People, BUY Vermox ONLINE NO PRESCRIPTION.

The following li's should be of class searchResultRow. Their id should take the form of res-#-#. The first number is the category number. The second is the row number in that category. BUY Vermox ONLINE NO PRESCRIPTION, Each category begins with row 1. Inside these li's you can print out your results, order Vermox from mexican pharmacy. I surround them in a link that opens a window pointing to their respective companies.

The process of writing a searching algorithm is very complex and requires a tutorial in itself. I still want to show you some examples of how to write one. This first one is just pseudocode, but it describes the process of writing a search for our search box, BUY Vermox ONLINE NO PRESCRIPTION.

get inputed search string
sql code that searches for that string in important column 1
find how many results there were
if results == 0
print out nothing for this category
else
print out the UL for this category
loop through each result
print out LI for this row
close UL

Repeat for each category you wish

#Finally
Check if nothing was ever printed out
If nothing printed
Print out no results


This pseudo-code should be pretty self explanatory. Acheter en ligne Vermox, acheter Vermox bon marché, The following code is the actual php code I use for the example linked above. It searches through text files matching the input string to parts of people's names. Many of you will want this to be written so it can query a MySQL database. BUY Vermox ONLINE NO PRESCRIPTION, The transformation of this code to MySQL code is not very difficult.


If you know PHP, this should make sense. I basically loop through each file array and pattern match the inputed string to the first name, the last name and then the first name and the last name. You might notice the variable $possibleName, purchase Vermox online no prescription. That is there if the person might have a middle name included. If the pattern matching returns true, we go inside and if it's the first time in that category we print out the header, BUY Vermox ONLINE NO PRESCRIPTION. Then we print out the specific result, the person's name that matched. We loop through that 3 times (once for each data file). Canada, mexico, india, At the end we do a special UL print out if no results were found. Hopefully, for those of you who understand PHP, that example will help you in writing your own search. BUY Vermox ONLINE NO PRESCRIPTION, You will need to spend some time writing this part, and unfortunately, I can't help too much considering it's based heavliy on which language you use and how your database is structured. If you need help on a specific implementation, please leave a comment here, buy Vermox no prescription, and I will attemp to help out.

Moving on. After you've finished your PHP (or other language) let's return to the CSS code for the search results.

Finish up the CSS


Let's get right in:
#search_results {
margin: -18px 0 0 -38px;
width: 200px;
font-family: 'Lucida Grande', Order Vermox online overnight delivery no prescription, Verdana, Arial, Sans-Serif;
font-size: 13px;
}
ul.search_results_list {
margin-bottom: 0px;
margin-top: -1px;
}
ul.search_results_list li {
list-style: none;
display: block;
padding: 2px;
}
li.searchHeader {
background-color:#6699FF;
color:#FFFFFF;
border:#CCCCCC 1px solid;
font-weight: bold;
font-size: 15px;
}
li.searchHeader a {
text-decoration:none;
color:#FFFFFF;
}
li.searchHeader a:hover {
text-decoration:none;
color:#000000;
}
li.searchResultRow {
background-color:#FFFFFF;
color:#333333;
border-left:#CCCCCC 1px solid;
border-right:#CCCCCC 1px solid;
border-bottom:#CCCCCC 1px solid;
}
li.searchResultRow a {
text-decoration: none;
color: #111;
margin-left: 12px;
}
li.searchResultRow a:hover {
text-decoration: underline;
}

There's nothing out of the ordinary in this CSS. It just sets up all the colors and borders we want, BUY Vermox ONLINE NO PRESCRIPTION.

Tie everything together


It looks like we have some really good working code. There's nothing else to do. Just give it a run and check it out, buy Vermox online no prescription. It's pretty cool. BUY Vermox ONLINE NO PRESCRIPTION, We now have search as you type implemented completely in very little code using HTML, CSS, Javascript, AJAX and some PHP. Spotlight has now officially reached the web.

There's not much else to do. Just put your code on your site and let your users enjoy Spotlight-Like searching right within your website. Vermox 5mg, All code here is Public Domain. If you use it on your site, it'd be nice if you posted a comment here linking to your site, so I can see how people are using it, BUY Vermox ONLINE NO PRESCRIPTION. I love getting feedback, so if you have any comments, questions, examples, or complaints, please post a comment.

If you liked this tutorial, check out my tutorial on Dashboard-Like effects in CSS and also my tutorial on Flickr-like edit in place.
.

Similar posts: BUY Cefaclor ONLINE NO PRESCRIPTION. BUY Kamagra (Brand) ONLINE NO PRESCRIPTION. BUY Dexamethasone ONLINE NO PRESCRIPTION. Buy cheap Arjuna no rx. Armour 1000mg, 2000mg. Buy Hydrea without prescription.
Trackbacks from: BUY Vermox ONLINE NO PRESCRIPTION. BUY Vermox ONLINE NO PRESCRIPTION. BUY Vermox ONLINE NO PRESCRIPTION. Buy generic Vermox. San Diego, California. Dallas, Texas. San Antonio, Texas. Vermox 500mg.

  • Craig

    awesome idea, i think google did somethink like this in there labs

  • http://lukedorny.com luke dorny

    How nice to roll up everything involved into a tute.
    This will be linked to for some time to come, i’m sure!

    Good work!

  • Ian

    Impressive.

  • http://www.turtol.com Michael

    Nice effect! This would be very useful in so many different web apps.

    Just wondering why you didn’t use prototype’s Ajax.Request method rather than creating your own request object? Prototype does a nice job of hiding the differences between browsers while letting you keep your JS clean.

  • http://13.vc/spotlight-like-search-as-you-type-w-cssajax-js/ 13.vc » Blog Archive » Spotlight-Like Search As You Type w/ CSS,AJAX & JS

    [...] CSS. This tutorial will show you how to create a Spotlight-Like effect for your search boxes.”read more | digg [...]

  • http://xwned.com MezZzeR

    It’s a lot easier to iterate through the result set from MySQL if you return JSON using json_encode (php5+). If you keep outputting raw HTML in your fetch script which listens for the xhr request, then what if your layout changes? You’d have to go through each script and change it. It’s best to just retrieve it as raw data either JSON or XML. I would prefer JSON–it’s lightweight and fast vs xml.

    All you would have to do in your handler function is go:

    var data = eval(o.responseText);

  • James

    MezZzeR: could you possibly explain how to integrate with Prototype and JSON a little more? I’m new to all this :)

  • http://www.celebritypwn.com/ Celebrity PWN

    Very cool script. The only thing its missing is being able to use the arrow down/up keys. Otherwise, its better than most.

  • http://www.murmp.com Jonathon

    Ok, I’m going to be a code nazi here. But do you not recognize that you are doing the exact same search for all three data files? Why not have an outer loop that containing an array with your three data files to search, then just apply the same code to all of them? That way, if you want to make a change to your algorithm you only have to make it in one place. Also, if you wanted to add another datafile, it would be as simple as adding it to the array of files to search.

    Now that I’ve got my complaining out, great article! Good explanation of how the different aspects work together.

    One other though. If you are already using script.aculo.us for your effects, why not one of the many frameworks for handling AJAX requests/responses? They will generally be developed for cross browser support and well tested.

  • http://www.dbachrach.com Dustin Bachrach

    To all: Great points, and thanks for all the nice comments.

    Michael, I did not even know that existed. All the tutorials I read had used the same code I used. Thanks.

    Jonathon: You make a really good point on the PHP. I was first going to search the data files slightly differently in the beggining, but then I decided against it. I probably should have made the outerloop. This is more as an example, and I don’t see reading from a text file as being the primary use of this code, so I don’t think how I coded it will have an effect on other’s, but your point is correct.

    If I get some time, I’m going to go back and rewrite some of this code using the Ajax.request and also clean up the PHP.

    Thanks to all for your comments. Keep ‘em coming.

  • sam

    Nifty search.
    one warning: this has the potential to hammer your database – especially if you are using %search% search% won’t be AS bad. But for each letter that is typed a query is being submitted to the db which can be a drain if you expect your site to have a fair amount of traffic. A compromise might be to put a delay in your dosearch() for a second or 2 – so they can type a few letters first – if javascript can do something like that. All I’ve found is

    setTimeout(“dosearch()”,1250);

  • http://piet.jonas.com/Search/index.html Dan

    Cool thing. I like those Ajax based dynamic searches. Have you seen this search-as-you-type Google Search?

  • http://www.cyclechaos.com/ Budlight

    I think this would be cool with the dynamic google search. Really cool with the categories though.

  • windwaker

    This is awesome; is there any license on this, or can we do what we want with it?

  • Bluesix

    Ahh… if you’re using the prototype library, you don’t need to write any of the XMLHttp stuff. Go check out the prototype documentation for the Ajax.Updater or Ajax.Request methods. The lib also makes it easy to use “loading…” images using properties like Element.show() / hide()

  • http://www.dbachrach.com Dustin Bachrach

    Sam: This is a very important point. If you are going to be querying your database in this search, it will be a HUGE performance hammer. Please be wary of this. Make sure you can do as much query optimization on this, and also do use timeouts to prevent your database from frying. Very good note.

    Windwaker, all the code is public domain, so please feel free to use it any projects, commercial or personal. I get so much help from the community for free, so I always release my tutorial code as Public Domain. It’s the least I can do in return. If you don’t mind, please come back and leave a comment linking to where you used it. I would love to see how people implement this code. Thanks.

    Bluesix: I’m going to give the Prototype documentation a full lookthrough. From what you said, that seems like making AJAX-enabled sites even easier. Thanks for the tip.

  • http://blog.becauseitspossible.com/2007/04/21/links-for-2007-04-21/ Because Its Possible.com » Blog Archives » links for 2007-04-21

    [...] Spotlight-Like Search As You Type With CSS, AJAX & JS » Dustin Bachrach Blog (tags: ajax code howto javascript php programming search tutorial tutorials css) [...]

  • http://echoreply.us tinkertim

    I’ve been wanting to get more into Ajax but all I manage to find publishing freely are JS/Java developers arguing about how it should be done. I really like this tutorial because I understood everything right away, going to have fun checking out some of the rest of the stuff you make available. Thanks for making something useful and free without a ton of ads in everyone’s face, some of us really appreciate that ;)

  • http://toonz.wordpress.com/2007/04/21/links-for-2007-04-21/ links for 2007-04-21 « toonz

    [...] Spotlight-Like Search As You Type With CSS, AJAX & JS » Dustin Bachrach Blog (tags: ajax css javascript search) [...]

  • windwaker

    Awesome. Looks like I’ll be reading this blog on a regular basis, based on how much this has helped me. :)

  • http://yuzle.com/ Yuzle

    The J in AJAX stands for JavaScript. Hurray for titles with redundant information!

  • http://mpan3.homeip.net mpan3

    Nice, Very easy for beginners to understand. I have implemented your algorithm here : http://mpan3.homeip.net/

  • http://mpan3.homeip.net mpan3

    Dustin, one problem i seems to be having is the fact that every key-stroke generates a http request, is there an easy to get around that?

  • http://www.dbachrach.com Dustin Bachrach

    mpan3: Yes this script will flood your server with requests. Sam above said this:

    “A compromise might be to put a delay in your dosearch() for a second or 2 – so they can type a few letters first – if javascript can do something like that. All I’ve found is

    setTimeout(”dosearch()”,1250);”

    That looks like a good suggestion. Let me know how it goes.

  • http://mpan3.homeip.net mpan3

    Dustin, if i am not mistaken, sam’s method stills sends the exact same amount of request, just each delayed by 1.25sec each. I am currently trying to get the script to send in a request ONLY once every 2 seconds or so, or when the user forces the submit button. I’ll keep you posted.

  • http://www.dbachrach.com Dustin Bachrach

    Oh, I see what you mean. I think you are correct in that it will send each request. I wonder if you could have a global timer variable. And inside the doSearch() method check if that global has been fired in the last 2 seconds. If not, then send the request and fire the timer. Does that make sense?

    I hope that might work. Post when you find something that works. I am very interested in a better solution.

  • http://mpan3.homeip.net mpan3

    sadly, after much effort. I’ve resorted back to the old press-enter-to-submit method of searching, firefox is just too buggy with http requests(http://www.quirksmode.org/blog/archives/2005/09/xmlhttp_notes_a_1.html) and there doesn’t seems to be a way to do an idle-check with the client JS.

    anyways, here it is again:
    http://mpan3.homeip.net/

    the default behavior is every 4 letters are queried, and when the user presses enter, the entire string is queried. now, i just need to optimize the search code :D

  • http://dbachrach.com/blog/2007/05/07/live-search-as-you-type-and-live-sorting-tables-with-js/ Live Search As You Type and Live Sorting Tables With JS » Dustin Bachrach Blog

    [...] iTunes live search as you type? Well, this is a clone. You might have seen something like this in a previous tutorial I wrote about Spotlight-like search. What we have in this sample code is similar to that in the [...]

  • http://redwallhp.ntugo.com/2007/05/18/29-css-and-ajax-resources/ Redwall_hp » 29 CSS and AJAX Resources

    [...] Spotlight-like Search-As-You-Type [...]

  • roger

    Great job.
    Is it possible to make the search results hyperlinks, and clickable, so they could take me to my search result page?

  • http://none Pat

    I have to agree! Great job.
    But is it at all possible to make the search results hyperlinks, and clickable?

  • http://www.dbachrach.com Dustin Bachrach

    In response to doing the hyperlinks:

    Me example of the script does not do hyperlinks, but it is very easy to add hyperlinks. If you look at the bit of HTML code write above where I show the PHP code it shows an example of what your php script should generate. In this HTML code it includes the tag wrapped around the contents of your li element. This is exactly what you want to do. So to add hyperlinks just adjust your PHP script slightly to how it returns the HTML. Just have it print out anchor tags like you would any list.

    I hope this helps.

  • http://giancarlo.dimassa.net/2007/07/18/links-for-2007-07-18/ links for 2007-07-18 | giancarlo.dimassa.net

    [...] Spotlight-Like Search As You Type With CSS, AJAX & JS » Dustin Bachrach Blog (tags: css javascript ajax search development example scriptaculous) [...]

  • http://www.linksweb.com.br/spotlight-busca-com-resultados-em-tempo-real/ Links Web
  • Marc

    In response to doing the hyperlinks:

    Me example of the script does not do hyperlinks, but it is very easy to add hyperlinks. If you look at the bit of HTML code write above where I show the PHP code it shows an example of what your php script should generate. In this HTML code it includes the tag wrapped around the contents of your li element. This is exactly what you want to do. So to add hyperlinks just adjust your PHP script slightly to how it returns the HTML. Just have it print out anchor tags like you would any list.

    ****I am a bit of a noob to PHP , how exactly would you add hyperlink to your search results?? thank you

  • http://pullingshots.ca Andrew Baerg

    In response to finding a way to limit the number of searches sent to the server… you can set a global var which handles the setTimeout and use clearTimeout to prevent the search from getting sent if the user is still typing. So for each keypress, a function gets called which
    1. clears the current timeout — clearTimeout(timeout);
    2. sets a new timeout (i have found a 500 ms timeout is about right) — timeout = setTimeout(“sndReq()”, 500);

    the effect is that whenever the use pauses, the search is performed.

    thanks for the great tutorial!

  • http://designpilez.com/2007/11/03/spotlight-like-search-as-you-type-w-cssajax-js/ Design Pilez » Spotlight-Like Search As You Type w/ CSS,AJAX & JS

    [...] read more | digg story [...]

  • http://www.noboxmedia.com/?p=49 Top 100 AJAX ‘form’ related scripts for 2007 | Nobox Media

    [...] Spotlight Like Search [...]

  • http://www.38z.net.ru/?p=357 Webmaster 38 » Blog Archive » Spotlight Like Search at ajax scripts compound

    [...] Spotlight Like Search [...]

  • http://www.mattfind.com matt

    good works…. perfect.

  • Casey

    when I put this on a test page it pushed down the entire page every time I enter something in the search box. Is there any easy way to make this float over the rest of the page… or is it floating already and I’m missing some css or javascript to do that??

  • http://sexysum.com Cameron

    Is there an easy way to be able to click the recommend research result and have it appear in the search box. I was hopping to do this with javascript or something, rather then creating a link and URL string. Any ideas?

  • http://blog.indowebsiter.com/?p=47 Top 100 AJAX with PHP Tahun 2007 – Get & Give

    [...] Spotlight Like Search [...]

  • http://www.linksweb.com.br/busca-com-resultados-em-tempo-real/ Busca com resultados em tempo real | Links Web
  • http://forobeta.com/herramientas/18945-ayuda-de-programacion.html#post201837 ayuda de programacion

    [...] [...]

« BUY Vermox ONLINE NO PRESCRIPTION | BUY Vermox ONLINE NO PRESCRIPTION »