diff options
-rw-r--r-- | phpfspot.js | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/phpfspot.js b/phpfspot.js index be62cfb..8db1f65 100644 --- a/phpfspot.js +++ b/phpfspot.js @@ -277,17 +277,21 @@ function startSearch() var objTemp = new Object(); objTemp['action'] = 'search'; - if(document.getElementsByName('searchfor_tag')[0].value != "") { + if(document.getElementsByName('searchfor_tag')[0] != undefined && + document.getElementsByName('searchfor_tag')[0].value != "") { objTemp['for_tag'] = document.getElementsByName('searchfor_tag')[0].value; } - if(document.getElementsByName('searchfor_name')[0].value != "") { + if(document.getElementsByName('searchfor_name')[0] != undefined && + document.getElementsByName('searchfor_name')[0].value != "") { objTemp['for_name'] = document.getElementsByName('searchfor_name')[0].value; } - if(document.getElementsByName('consider_date')[0].checked == true) { + if(document.getElementsByName('consider_date')[0] != undefined && + document.getElementsByName('consider_date')[0].checked == true) { objTemp['from'] = from; objTemp['to'] = to; } - if(document.getElementsByName('consider_rate')[0].checked == true) { + if(document.getElementsByName('consider_rate')[0] != undefined && + document.getElementsByName('consider_rate')[0].checked == true) { objTemp['rate_from'] = rate_search['from']; objTemp['rate_to'] = rate_search['to']; } @@ -346,16 +350,19 @@ function setViewMode(mode) */ function clearSearch() { - document.getElementsByName('searchfor_tag')[0].value = ''; - document.getElementsByName('searchfor_name')[0].value = ''; + if(document.getElementsByName('searchfor_tag')[0] != undefined) + document.getElementsByName('searchfor_tag')[0].value = ''; + if(document.getElementsByName('searchfor_name')[0] != undefined) + document.getElementsByName('searchfor_name')[0].value = ''; - if(document.getElementsByName('consider_date')[0].checked == true) { + if(document.getElementsByName('consider_date')[0] != undefined && + document.getElementsByName('consider_date')[0].checked == true) { document.getElementsByName('consider_date')[0].checked = false; datesearch(); } - if(document.getElementsByName('consider_rate')[0].checked == true) { + if(document.getElementsByName('consider_rate')[0] != undefined && + document.getElementsByName('consider_rate')[0].checked == true) { document.getElementsByName('consider_rate')[0].checked = false; - datesearch(); } } // clearSearch() |