javascript傳參字串 與引號的巢狀呼叫
問題:
<onclick=click_passFloorNum(1,1s12)'> 執行並點選後,一點反映都沒有;
但是換成:<onclick=click_passFloorNum(1,1234)'> 可以
說明有字母時,要用'1s12'
for(var t=0;t<arr.length;t++)
if(arr[t]!="")
{
if(isNaN(arr[t]))
floorNumLinks += "<input type='button' id='floorNumId' value='"+arr[t]+"' onclick=click_passFloorNum("+json[a].buildingId+",'"+arr[t]+"')>";//此處應將click_pass之前的單引號去掉
else
floorNumLinks += "<input type='button' id='floorNumId' value='"+arr[t]+"' onclick='click_passFloorNum("+json[a].buildingId+","+arr[t]+")'>";
}
//點選傳遞校區id,樓id,樓層號給圖紙顯示介面
function click_passFloorNum(buildingId,floorNum){
var path = document.getElementById("contextPath").value;
var sceneId = document.getElementById("sceneId").value;
alert(sceneId);
alert(buildingId);
alert(floorNum);
window.open(path+"/bsuims/formViewPageInit.do?contextName=bsHouseHouseInfoFloorPlanGraphViewPage&sceneId="+sceneId+"&buildingId="+buildingId+"&floorNum="+floorNum);
}