HTML
  Home arrow HTML arrow Page 3 - Using the Find Functions for HTML Database...
Dev Articles Forums 
ADO.NET  
Apache  
ASP  
ASP.NET  
C#  
C++  
ColdFusion  
COM/COM+  
Delphi-Kylix  
Design Usability  
Development Cycles  
DHTML  
Embedded Tools  
Flash  
Graphic Design  
HTML  
IIS  
Interviews  
Java  
JavaScript  
MySQL  
Oracle  
Photoshop  
PHP  
Reviews  
Ruby-on-Rails  
SQL  
SQL Server  
Style Sheets  
VB.Net  
Visual Basic  
Web Authoring  
Web Services  
Web Standards  
XML  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
HTML

Using the Find Functions for HTML Database Forms
By: Chrysanthus Forcha
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 2
    2008-08-20

    Table of Contents:
  • Using the Find Functions for HTML Database Forms
  • The ordinarySearch() function
  • The getTwoWords() Function
  • The find() Function

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    Using the Find Functions for HTML Database Forms - The getTwoWords() Function


    (Page 3 of 4 )

    The find() function issues a prompt dialog box. This dialog box has only one input text control. In this control the user types in the title of the column separated by a space and then the value of the cell for the row that the search has to get. The search process needs these two values in order to get the row.

    Note: if two or more consecutive rows have this same cell value, any of the rows will be displayed. To limit this, you will have to write your code so that the prompt box receives more than one column title. For simplicity I do not take that into account for this series. Here the prompt dialog box receives only one title name and the cell value.

    The prompt dialog box returns the two words as a single string. The getTwoWords() function separates the string into the two separate words. As an argument it receives the string that has the two words. It returns the two words in an array. If the user typed in correctly, the first element in the array is the title and the second is the cell value. This is the function:


    function getTwoWords(entry)

    {

    var firstWord = "";

    var secondWord = "";

    var i = 0;


    do

    {

    firstWord+= entry.charAt(i);

    ++i;

    if (i == entry.length)

    break;

    } while (entry.charAt(i) != " ")


    if (i != entry.length)

    {

    ++i; //take account of the space

    do

    {

    secondWord+= entry.charAt(i);

    ++i;

    } while (i <= (entry.length-1))

    }


    var tempArr = new Array(2);

    tempArr[0] = firstWord;

    tempArr[1] = secondWord;

    return tempArr;

    }


    In this function there are two while loops. The first while loop extracts the first word. The second while loop extracts the second word if it was typed (that is, if while extracting the first word, the iteration of the received string was not complete). You can use Regular Expressions to achieve this. I have not used one here because many programmers still have not mastered Regular Expressions. However, I will soon be using them in my articles.

    More HTML Articles
    More By Chrysanthus Forcha


       · Let's continue with this part of the series.Chrys
     

    HTML ARTICLES

    - Hello HTML 5, Goodbye Gears
    - Comparing Browser Response to Active Client ...
    - Testing Browser Response to Active Client Pa...
    - Active Client Pages: Completing the Code for...
    - ACP and Browsers: Setting up an Example
    - How Browsers Respond to Active Client Pages
    - Completing a Tree with Active Client Pages
    - HTML Form Verification and ACP
    - Building an ACP Tree
    - Completing an ACP 3D HTML Table Image Gallery
    - Building an ACP 3D HTML Table Image Gallery
    - A Multiple Page Image Gallery with Active Cl...
    - Building an Image Gallery with Active Client...
    - Concluding a Menu for All Browsers
    - A Vertical Menu for All Browsers







    © 2003-2010 by Developer Shed. All rights reserved. DS Cluster 10 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek