Hi all expert,
I have a question to ask:
I want to put a button on htm file which can open a dialog I can select file from local drive, it is like a <input type="file"> but because <input type="file"> can't preset the value.
but when I use
var cdl = new ActiveXObject("MsComDlg.CommonDialog"
to create a commondialog object, it doesn't work. It shows
Automation server can't create object error.
attached is my code. I use window2000/IE5.5/Office2000.
<html>
<head></head>
<script >
function getfile( ){
var cdl = new ActiveXObject("MsComDlg.CommonDialog"
cdl.showopen;
this.document.form1.txtFile.value = cdl.filename;
}
</script>
<form name="form1">
<input type = "text" name = "txtFile" >
<input type = "button" value = "Browse ..." onClick="getfile )" >
</form>
</html>
Thanks.
Megi
I have a question to ask:
I want to put a button on htm file which can open a dialog I can select file from local drive, it is like a <input type="file"> but because <input type="file"> can't preset the value.
but when I use
var cdl = new ActiveXObject("MsComDlg.CommonDialog"
to create a commondialog object, it doesn't work. It shows
Automation server can't create object error.
attached is my code. I use window2000/IE5.5/Office2000.
<html>
<head></head>
<script >
function getfile( ){
var cdl = new ActiveXObject("MsComDlg.CommonDialog"
cdl.showopen;
this.document.form1.txtFile.value = cdl.filename;
}
</script>
<form name="form1">
<input type = "text" name = "txtFile" >
<input type = "button" value = "Browse ..." onClick="getfile )" >
</form>
</html>
Thanks.
Megi