Ir para conteúdo

POWERED BY:

Arquivado

Este tópico foi arquivado e está fechado para novas respostas.

Mvrk

Javascript trigger objects .click() event

Recommended Posts

Hi i got a file input object, but i want it to be hidden, and then i user a picture as button to trigget that hidden file input object, the thing is it works fine on IE, but on Firefox wont do anything, not even errors, anyone knows how to trigger the click() event on Firefox?Here is my code:function open_filebrowser(){ document.getElementById("fileBrowse").click();}<input type=file id='fileBrowse' style='display:none;'><img id="bf" src="graphics/open.gif" style='cursor:pointer;' onclick='open_filebrowser();'>

Compartilhar este post


Link para o post
Compartilhar em outros sites

こんいちわ

 

イー・マスターのフォーラムーへ、ようこそ。

hi, welcome to iMasters forum

 

私は解決を研究していますので。。

i'm looking solution for correct use of this object

 

 

この例を見なさい

in this thread, a example:

 

http://forum.imasters.com.br/index.php?showtopic=248311

 

 

Internet Explorer -> ok

Maxthon -> ok

Firefox -> dont work

Netscape -> dont work

Opera -> dont work

Safari -> dont work

 

 

 

perharps this snippet code can be usefull

 

HTMLElement.prototype.click = function() {var evt = this.ownerDocument.createEvent('MouseEvents');evt.initMouseEvent('click', true, true, this.ownerDocument.defaultView, 1, 0, 0, 0, 0, false, false, false, false, 0, null);this.dispatchEvent(evt);}

see this:

 

http://www.quirksmode.org/dom/inputfile.html

Compartilhar este post


Link para o post
Compartilhar em outros sites

×

Informação importante

Ao usar o fórum, você concorda com nossos Termos e condições.