我在php中使用了一些html代碼和javascript代碼。所有代碼HTML和JavaScript是ALREAY在ECHO.The HTML代碼是這樣的:Php重定向涉及javascript檢查
<div id="ShippingInfo">
<label>Available Quantity '.$value.' Meters</label><br><br>
<label>Want to Buy </label>
<input id= "userDemand" type="number" size="20" name="UserDemand" value="" aria-describedby="name-format" placeholder="Enter Integers Only" pattern="\d*" > <label ><font size="3">meters</font></label> <br><br>
<label>Cost </label><br>
<button type="button" onclick="validateMyForm()">
</div>
在按鈕的onclick我打電話這樣的JavaScript方法:
<script type=\"text/javascript\">
function validateMyForm()
{
if ((document.getElementById('userDemand').value)<='".$value."')
{
document.location = 'AB17.php?cat='".$pCat."'&productType='".$pName."'&page='".$page."';
return true;
}
else
{
return false;
}
}
</script>
所有代碼都是ecohing所以沒有問題的報價。問題是它不工作。當我點擊按鈕什麼也沒有發生。請幫助!
整個腳本已經在echo.This html和javascript代碼寫在PHP內部,所以它已經在回聲中了。我已經在回顯代碼了。 –
這不是一個真正的方法,我的意思是機會更多的是改變應用這些改變的代碼,然後嘗試 –