Please is it possible to call up the system's file uploa开发者_如何学Pythond window with an anchor tag? And if it is, would JQuery need to be involved?
No, you won't be able to do that.
What you can do is that use an input type="file", make the transparency as 100% put an anchor behind that.
You can see a working demo.
You can try this Jquery plugin. http://valums.com/ajax-upload/ The solution is make the input type="file" transparent and put your custom button upon it. The input type="file" can't be triggered programmatically, but just with a real interaction by the user (in this case a mouse click)
Possible if you trick it a little bit.
HTML:
<a href='#' id='#upfile1'>Upload File</a>
<input type="file" id="file1" name="file1" style="display:none" />
JQuery:
$("#upfile1").click(function () {
$("#file1").trigger('click');
});
The input tag should be hidden. Change the CSS according to your wish.
HTML:
<input id="upload" type="file"/>
<a href="" id="upload_link">Upload your file</a>
JQuery:
$(function(){
$("#upload_link").on('click', function(e){
e.preventDefault();
$("#upload:hidden").trigger('click');
});
});
CSS:
#upload_link{text-decoration:none;}
#upload{display:none}
精彩评论