我喜歡下面在我的HTML頁面的鏈接:參數傳遞給javascript函數非常久遠的回調
<a id="save_report" href="javascript:void(0);" title="Save Report" onclick="javascript:enterReportNameToSave(<?php echo $upload_count?>,<?php echo $startOffset;?>,<?php echo $affiliateId; ?>);">Save Report <img height="16" width="16" style="vertical-align: bottom;" src="/img/icn_export.gif" alt="export"></a>
如,你可以看到,我需要一些參數發送到功能enterReportNameToSave同時,我還需要調用回調函數以處理彈出窗口。
我enterReportNameToSave()函數調用將是這樣的:
function enterReportNameToSave(count,startOffset,user_id,f)
{
//Some logic to set a div element based on the parameter values
f()//This will be the implementation of my call function
{
//Here I need to invoke the popup logic
}
}
在這裏,我很困惑與正確實施這一點,我的意思是實施方案的正確方法。請幫忙。
其實我想寫一個事件處理程序,將與**的onclick **鏈接的情況下,somethig像**功能執行的東西(e){var popup_di_iid = e.target.title} **在那裏我會保留我的彈出邏輯。但我也需要將其他參數傳遞給** enterReportNameToSave **函數。如何實現? – debaShish