Related:
- Please review my javascript code because it's not working
- Battery reset code - Guide
- How long does facebook review take - Guide
- Samsung volume increase code - Guide
- Disable javascript chrome - Guide
- How to disable javascript in tor - Guide
1 response
Well, I have never seen a Javascript formed in this manner: search = function(){
The above would populate a variable called search, with the return value of what ever the FUNCTION FUNCTION would return. You cannot name a function FUNCTION!
Try this:
// search functionality
function SEARCHPAGE(){
query = document.getElementById('search').value;
if (query == "") {
return;
}
found = -1; // initialize found to false
for (var i = 0; i < dictionary.length; i++) {
if (query == Dictionary[i].word) {
found = i;
break;
}else {
document.getElementById('word_text').innerHTML = "Word not found";
document.getElementById('definition').innerHTML = "The word you entered is not found in our dictionary";
document.getElementById('related').innerHTML = "No related words";
}
}
if (found >= 0) {
msgbox("found: " & found);
}
}
The above would populate a variable called search, with the return value of what ever the FUNCTION FUNCTION would return. You cannot name a function FUNCTION!
Try this:
// search functionality
function SEARCHPAGE(){
query = document.getElementById('search').value;
if (query == "") {
return;
}
found = -1; // initialize found to false
for (var i = 0; i < dictionary.length; i++) {
if (query == Dictionary[i].word) {
found = i;
break;
}else {
document.getElementById('word_text').innerHTML = "Word not found";
document.getElementById('definition').innerHTML = "The word you entered is not found in our dictionary";
document.getElementById('related').innerHTML = "No related words";
}
}
if (found >= 0) {
msgbox("found: " & found);
}
}
Feb 18, 2019 at 06:45 PM
Feb 18, 2019 at 06:52 PM
Feb 18, 2019 at 07:34 PM
Feb 19, 2019 at 08:22 AM
and it workd thank you for your help
Feb 19, 2019 at 09:11 AM