immunity Posted June 27, 2007 Share Posted June 27, 2007 Hello :/ I have many pages with many scripts (about 2-3 functions do XMLhttprequest)now i try to execute this functionif i displace sellItem() with other function ,the other function is executed.if i put sellItem() in other button it isnt execute<input type="button .... onclick="sellItem()" />function sellItem(){ var x =document.getElementById("login"); var y = document.getElementById("lpassword"); if ( x.value!="" && x.value!="Account" && y.value!="" && y.value!="Password") { var url="checklogin.php?a="+document.getElementById("login").value+"&p="+document.getElementById("lpassword").value; alert(url); http.open("GET", url, true); http.onreadystatechange = function() { if(http.readyState == 4 && http.status == 200) { var results= http.responseText; if ( results.match("Problem") != "Problem" ) { alert("success!!"); } } } } else { alert("Please enter your password"); }} Link to comment Share on other sites More sharing options...
justsomeguy Posted June 27, 2007 Share Posted June 27, 2007 <input type="button .... onclick="sellItem()" />That will execute the sellItem function assuming it has been defined by the time the button is clicked. Put an alert first thing in the function to prove it. Also check for Javascript errors on the page. Link to comment Share on other sites More sharing options...
immunity Posted June 27, 2007 Author Share Posted June 27, 2007 <input type="button .... onclick="sellItem()" />That will execute the sellItem function assuming it has been defined by the time the button is clicked. Put an alert first thing in the function to prove it. Also check for Javascript errors on the page.i puted alert boxafter http.open( ) none alert box is working !:)from mozila i seegetElementById("login") has no propertiesgetELementById("lpassword") has no propertiesand !1) [Exception... "Component returned failure code:0x80040111(NS_ERROR_NOT_AVAILABLE) .....2) uncaught exception Link to comment Share on other sites More sharing options...
justsomeguy Posted June 27, 2007 Share Posted June 27, 2007 What do you mean after http.open, does that mean that everything before http.open works? If so, then obviously the problem is that http.open is failing. Put a try/catch block around http.open to catch the exception, or do a search on that error code to see what it means. Link to comment Share on other sites More sharing options...
immunity Posted June 27, 2007 Author Share Posted June 27, 2007 What do you mean after http.open, does that mean that everything before http.open works? If so, then obviously the problem is that http.open is failing. Put a try/catch block around http.open to catch the exception, or do a search on that error code to see what it means.yes everything before that http.open works fine !Althought in others fuction that i have http.open it works correctly :/well i am up to search about these exceptions Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.