I try to create an online dictonary for a schoolprojekt. But I need to know if there’s a HTML code to write a search field (like the one on LEO e.g.) to look up the words. ? Thanks for every help!!?
@lisauthorMar 21.2007 — #I really need your help! I would like to create an online dictonary for a very important school project but I don't know how to make a search field. You should be able to type in your word and then automaticly come to a new site with the translation.(want to make a English/German dictonary).
Is there a simple HTML code? If not is there any HTML code? Thanks for any answer!
@TheBearMayMar 21.2007 — #Couple of ways you could go about this depending on what you have available. Best way requires the use of some server side processing (PHP, JAVA, ASP, ASP.net, CGI, etc), but I'm guessing that you might not have that available. If my guess is correct there are still ways of doing it but you'll need some javascript.
@TheBearMayMar 21.2007 — #Over time and as more words get added this won't be viable, but a simple lookup with javascript would look something like: [code=html] <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <title>Word Lookup</title> <script type="text/javascript"> var gArr=["GermanWord1", "GermanWord2"];//add German words to this array var eArr=["EnglishWord1", "EnglishWord2"];//add English words to this array var wordArr = new Array(gArr, eArr);
function findWord(sWord) { if (document.getElementById("e2G").checked) { for (i=0;i<eArr.length;i++) { if (wordArr[1][i] == sWord) { alert(wordArr[0][i]); break; } } if (i>=eArr.length) alert(sWord+" not found"); } else { for (i=0;i<eArr.length;i++) { if (wordArr[0][i] == sWord) { alert(wordArr[1][i]); break; } } if (i>=eArr.length) alert(sWord+" not found"); } } </script> <body> <input type="text" id="tSrch" /> English to German <input type="checkbox" id="e2G" checked="checked" /> <br /> <button onclick="findWord(document.getElementById('tSrch').value)">Search</button>