input type="file" auto click
How do I automatically open the browse dialog of an input type=开发者_高级运维"file" when the page first opens?
I don't think you should do this. If you've ever visited a MySpace page, you know how frustrating it can be when a web page activates things on its own when the page loads.
Don't violate how the UI is supposed to work, let the user ask for the dialog.
Besides, if the users instinctively closes it like a popup, and then realizes they needed it, it may not be obvious how they should get the dialog back. Then they will reload the page just to show the dialog again -- all frustrating things you could be avoiding.
That being said, I'm not sure why you want to do this in the first place. This is just my first reaction to what you're asking.
This is completely impossible in Firefox.
In other browsers, you can:
document.getElementById('inputId').click();
fire the click event on the button on document ready
$(document).ready(function() {
$("#buttonid").click();
});
精彩评论