I have a Javascript function
function changeDocument(idxpv, open){
if(open)
$("#Upload"+idxpv + " input[type=file]").click();
}
and a link
<a href="javascript:changeDocument(1,true);" class="close fileupload-exists"
data-dismiss="fileupload">change document</a>
Now on clicking the link IE9/8 shows the prompt box asking for LEAVE THE PAGE
and STAY ON PAGE
EDIT
The file upload button is generated from Valum's qqFileuploader library.
Could someone guide me whats wrong with it?
The call to $("#Upload1 input[type=file]").click();
is not executed because open
is undefined.
I copied your code in this document:
changeDocument()
If you change the calling to this javascript:changeDocument(1, true);
the click is fired and the file open dialog is called.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>html 5</title>
<script src="../jQuery/jquery_1.9.1.js"></script>
<script>
function changeDocument(idxpv, open){
console.log("idxpv", idxpv);
console.log("open", open);
if(open)
$("#Upload"+idxpv + " input[type=file]").click();
}
</script>
</head>
<body>
<p>
<a href="javascript:changeDocument(1, true);" class="close fileupload-exists"
data-dismiss="fileupload">change document</a>
</p>
<p id="Upload1">
input type=file: <input type="file">
</p>
</body>
</html>
If you have more questions feel free to ask.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.