我想提醒在它連字符的數字,但它使計算的數量,而不是...的Javascript:警惕一些與它
HTML/PHP
echo '<input type="submit" name="remove" value="remove" onclick="removeEntry(' .
$row['Incident'] . ',' . $row['Fogbugz Number'] . ')" />';
這已經過測試,並返回一個連字符對形成正確的價值觀(檢查該頁面的源)
"onClick="removeEntry(123456-001111, 123456)"
這是當我嘗試的JavaScript會發生什麼:
Javascript
function removeEntry(incident, fogbugz){
alert(incident);
}
這會導致與122345.一個警告框,但是我想它返回「123456-001111」
我曾嘗試:
alert(toString(incident));
alert(incident.toString());
alert(str(incident));
alert(incident.value);
incident = incident.value
alert(incident);
我想不通這一個:(
顯示您的呈現HTML,而不是您的PHP:JavaScript是客戶端。 – 2012-04-12 17:38:26