我的功能是这样的:
function delete(type, id){
if(id){
window.location.href = '/site/'+type+'/delete/'+id;
}
}
我这样称呼它:
onclick="delete('position', <?php echo $key;?>)
我应该在函数的哪个位置放置“确认”选项?
我的功能是这样的:
function delete(type, id){
if(id){
window.location.href = '/site/'+type+'/delete/'+id;
}
}
我这样称呼它:
onclick="delete('position', <?php echo $key;?>)
我应该在函数的哪个位置放置“确认”选项?
试试这个:
function deleteIt(type, id)
{
if(id && confirm('Are you sure you want to delete?'))
{
window.location.href = '/site/'+type+'/delete/'+id;
}
}
function delete(type, id)
{
if(id && (confirm('Are you sure you want to delete?')))
{
window.location.href = '/site/'+type+'/delete/'+id;
}
}