phpSensei Posted February 19, 2008 Share Posted February 19, 2008 It says Object Expected, line 44 name = "textField" onkeyup = "checkUsername(event)"> Full Code <script language="javascript"> function getData(dataSource) { if(XMLHttpRequestObject) { XMLHttpRequestObject.open("GET", dataSource); XMLHttpRequestObject.onreadystatechange = function() { if (XMLHttpRequestObject.readyState == 4 && XMLHttpRequestObject.status == 200) { if(XMLHttpRequestObject.responseText == "taken"){ function checkUsername(keyEvent) { var targetDiv = document.getElementById("targetDiv"); targetDiv.innerHTML = "<div>That username is taken.</div>"; } } } XMLHttpRequestObject.send(null); } } function checkUsername(keyEvent) { keyEvent = (keyEvent) ? keyEvent: window.event; input = (keyEvent.target) ? keyEvent.target : keyEvent.srcElement; if (keyEvent.type == "keyup") { var targetDiv = document.getElementById("targetDiv"); targetDiv.innerHTML = "<div></div>"; if (input.value) { getData("user.php?qu=" + input.value); } } } </script> <body> <H1>Choose a username</H1> Enter your new username <input id = "textField" type = "text" name = "textField" onkeyup = "checkUsername(event)"> <div id = "targetDiv"><div></div></div> </body> Quote Link to comment Share on other sites More sharing options...
PHP Monkeh Posted February 21, 2008 Share Posted February 21, 2008 Add another } before your </script>, that should sort it. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.