Hey everyone....Im working on a real basic image viewer and im finally making some headway on this project. It works if I click search but not if i hit enter....any ideas why? heres my code:
Code:
<html> <head> <script Language="JavaScript"> function JSTest(){ if (document.form1.txtSearch.value != ''){ //document.imgTest.src = document.form1.txtSearch.value + ".jpg"; //document.getElementById("imgTest").src = document.form1.txtSearch.value + ".jpg"; var floatimg = document.getElementById('imgTest'); floatimg.src = document.form1.txtSearch.value + ".jpg"; } } </script> </head> <body> <form name="form1"> <input type="text" name="txtSearch" ><br> <input type="button" value="search" onclick="JSTest();"> <hr> <IMG NAME="imgTest" id="imgTest" src="" alt=""> <hr> </form> </body> </html>
Comment