这是Javascript函数.请解释如何在Javascript中比较两个字符串.
<head>
<script type="text/javascript">
/*javascript function*/
function ajax(str)
{
if (str.length==0)
{
document.getElementById("res").innerHTML="";
return;
}
if(str=="Select City")
{
alert("Please Select a City");
}
document.getElementById("res").innerHTML=="";
var url="code1.php?q="+str+"&r"+Math.random();
var obj;
try{
obj=new ActiveXObject(Microsoft.XMLHTTP);
}
catch(e)
{
try
{
obj=new XMLHttpRequest();
}
catch(e)
{
alert("Your browser not suport ajax");
}
}
obj.open('Get',url,true);
obj.send(null);
obj.onreadystatechange=function()
{
if(obj.readyState==4)
{
document.getElementById("res").innerHTML=obj.responseText;
}
}
}
</script>
</head>
<body>
<select onchange="ajax(this.value)" name="sel" id="btn"><option>Dharmashala</option><option>Manali</option><option>Shimla</option></select>
<div id="res"></div>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
但它没有用,请建议我这样做的正确方法.
我有两个表:
这是表1:
product_id|product_desc|product_name|product_s_desc
Run Code Online (Sandbox Code Playgroud)
这是表2:
product_price_id|product_id|product_price
Run Code Online (Sandbox Code Playgroud)
现在,我想从这些表中获取数据。product_id在两个表中都相同。
我想拿
product_s_descproduct_descproduct_name与product_price其他表格中的AND 。请帮我做到这一点。