Hi,
I'm new to asp.net. On the navigation bar of my master page i have created a searchbox and button:
<FORM name="localSearch" onsubmit="return usekey()">
<input type="text" name="keywordText" size="20" id="keywordText" tabindex="1" />
<input type="button" value="Search" name="searchButton" onclick="performSearch()" id="searchButton" tabindex="2"/>
</FORM>
// *************************** Main **********************
function performSearch() { // Handle the clicking of the search button
var searchKeys = getSearchKeywords()
var results = search('true', searchKeys)
results_num = results.length // added, number of links found
results = makeAnchorList(results, search_results_link_target)
displayResults(results)
}
function getSearchKeywords() { // Return an array of keywords to search from the search form
var searchForm = document.forms["localSearch"]
var s = searchForm.elements["keywordText"].value
var a1 = s.split(" ")
var a2 = new Array()
var count = 0
for (var i = 0; i < a1.length; ++i) {
if (a1[i] != "") {
a2[count] = a1[i]
++count
}
}
return a2
}
function usekey() { // enable the use of the return key to search
performSearch()
return false
}
// -->
</script>
my problem is that search button works on any .aspx page or html page but i can't get this work on the master page.
1- I have change the onlcick button to onclientclick butoon. didin't work.
2- I followed the solution on your website : var s =document.getElementById('<%=keywordText.ClientID%>');
which gives me an error that keywordtext is not declared or due to protection level...