Javascript keyword search description - what does this do?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jerry101
    New Member
    • Jul 2008
    • 28

    Javascript keyword search description - what does this do?

    hi,

    i stumbled accross a piece of coding in the between the <head> tags where you normally put your keywords etc and one website i saw had this piece of javascript there.

    Code:
    <script language="JavaScript" type="text/javascript">
    <!-- 
    //Keyword search function
    		function searchfocus() {
    			searchform.Query.focus();
    }
    //Compute search function
    	function computesearch() {
    		var pathValue = "/websites/UK/uk.nsf/SearchResults/?SearchView&Query=";
    		var queryValue = document.searchform.Query.value;
    		location = pathValue + queryValue;
    }
    
    function windowOpener(url, name, args) {
    if (typeof(popupWin) != "object"){
    popupWin = window.open(url,name,args);
    } else {
    if (!popupWin.closed){ 
    popupWin.location.href = url;
    } else {
    popupWin = window.open(url, name,args);
    }
    }
    popupWin.focus();
    }
    // -->
    </script>
    Can anyone let me know what this is actually doing please?

    Thanks
  • acoder
    Recognized Expert MVP
    • Nov 2006
    • 16032

    #2
    You're probably asking about this piece of code:
    Code:
    //Compute search function
    	function computesearch() {
    		var pathValue = "/websites/UK/uk.nsf/SearchResults/?SearchView&Query=";
    		var queryValue = document.searchform.Query.value;
    		location = pathValue + queryValue;
    }
    It opens/redirects to a search results page for the query value entered in the "Query" input text box.

    Comment

    Working...