上传文件时遇到问题。当我单击 ClickMe 按钮时,将显示对话框确认。当我单击确定按钮时,不会显示上传文件对话框。如果我在控制台中运行代码,则会显示上传文件对话框。这是我的源代码:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery.min.js" type="text/javascript"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.9.0/jquery-ui.min.js" type="text/javascript"></script>
<link rel="stylesheet" type="text/css" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.9.0/themes/dark-hive/jquery-ui.css" />
<script type="text/javascript">
function showUpload() {
$("#tpl_file").click();
};
$(document).ready(function(){
$("#verify_dialog").dialog({
"autoOpen": false,
"modal": true,
"buttons": [{
"id":"btn_okdialog",
"text": "yes",
"click": function() {
showUpload();
}
},
{
"id":"btn_cancedialog",
"text": "no",
"click": function() {
$(this).dialog("close");
}
}
]
});
$("#ClickMe").button();
$("#ClickMe").click(function(){
$("#verify_dialog").dialog("open");
});
});
</script>
</head>
<body>
<button title="ClickMe" id="ClickMe">ClickMe</button>
<input type="file" name="tpl_file" id="tpl_file">
<div id="verify_dialog" style="display:none;" title="verify_dialog">
<div id="message">are you sure?</div>
</div>
</body>
</html>
你能帮助识别错误吗?