how to compare two values from same textbox

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
khalidhabib.cs
Forum Newbie
Posts: 14
Joined: Tue Jul 17, 2012 1:35 am

how to compare two values from same textbox

Post by khalidhabib.cs »

function Show_charges(str,str2)
{
//alert("Working");
var xhr;
if(window.XMLHttpRequest){
// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}

else {
// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function(){

if (xmlhttp.readyState==4 && xmlhttp.status==200){

document.getElementById("result").innerHTML=xmlhttp.responseText;
}
}
// alert(str2);
xmlhttp.open("GET","reply.php?q="+str+"&q2="+str2,true);
xmlhttp.send();
}//End of Ajax Function show charges from Database


This is php file
include('../include/db.php');
$q= $_GET['q'];
$q2= $_GET['q2'];
?>
<?php
$sql="SELECT service_amount FROM service_charges WHERE quantityFrom >='1' AND quantityTo <='4'";

and herer function calling

<input type="text" class="num-pallets-input" name="product_qty " id="turface-mvp-num-pallets" onkeyup="Show_charges(this.value,this.value)"/>
User avatar
social_experiment
DevNet Master
Posts: 2793
Joined: Sun Feb 15, 2009 11:08 am
Location: .za

Re: how to compare two values from same textbox

Post by social_experiment »

Could you explain how the script works plus give an example of what the input would look like
“Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” - Mosher’s Law of Software Engineering
Post Reply