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> Link to comment https://forums.phpfreaks.com/topic/91805-missing/ 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. Link to comment https://forums.phpfreaks.com/topic/91805-missing/#findComment-472557 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.