Цитата:
Ответ на вопрос "Почему нет?" - "Потому что так сделали!" (в IE тоже много чего есть, чего нет в других браузерах, и наоборот). |
Цитата:
<script type="text/javascript"> function dofocus(self) {document.body.appendChild(document.createTextNode('focus('+self.name+'), '))} function doblur (self) {document.body.appendChild(document.createTextNode('blur('+self.name+'), '))} </script> <form id="upload" method="post" enctype="multipart/form-data" action="/upload7"> <input tabindex="1" type=file name='file1' onfocus='dofocus(this);' onblur='doblur(this);'><br /> <div tabindex=2>div</div><br /> <input tabindex="3" type=file name='file2' onfocus='dofocus(this);' onblur='doblur(this);'><br /> <div tabindex=4>div</div><br /> <input tabindex="5" type=file name='file3' onfocus='dofocus(this);' onblur='doblur(this);'><br /> </form>по примеру видно что блюр работает но только на последнем инпуте |
devote, тогда уж и про хром отправлять, там при помощи мыши фокус вообще не установить.:)
|
Спасибо всем за ответы. Наверное это действительно баг.
По поводу Chromium. Такой вариант подойдет? <script type="text/javascript"> doclick = function (event) { if (navigator.userAgent.toLowerCase().indexOf('webkit') >= 0) { event.stopPropagation() event.target.focus() } } </script> <html> <body> <form action='/'> <input type=file onclick='doclick(event)'> </form> </body> </html> |
<script type="text/javascript"> function dofocus(self) {document.body.appendChild(document.createTextNode('focus('+self.name+'), '))} function doblur (self) {document.body.appendChild(document.createTextNode('blur('+self.name+'), '))} </script> <form id="upload" method="post" enctype="multipart/form-data" action="/upload7"> <table> <tr><td><input type="file" name='file1' onfocus='dofocus(this);' onblur='doblur(this);'/><td>file1</td> </tr> <tr><td><input type="file" name='file2' onfocus='dofocus(this);' onblur='doblur(this);'/></td><td>file2</td> </tr> <tr><td><input type="file" name='file3' onfocus='dofocus(this);' onblur='doblur(this);'/></td><td>file3</td> </tr> </table> </form> |
Deff
Что толку то? Мне фокус нужен на div. Ну или на td, как в последнем примере. Например так: <script type="text/javascript"> function dofocus(self) {document.body.appendChild(document.createTextNode('focus('+self.name+'), '))} function doblur (self) {document.body.appendChild(document.createTextNode('blur('+self.name+'), '))} </script> <form id="upload" method="post" enctype="multipart/form-data" action="/upload7"> <table> <tr><td><input type="file" name='file1' onfocus='dofocus(this);' onblur='doblur(this);'/><td tabindex=0>file1</td> </tr> <tr><td><input type="file" name='file2' onfocus='dofocus(this);' onblur='doblur(this);'/></td><td tabindex=0>file2</td> </tr> <tr><td><input type="file" name='file3' onfocus='dofocus(this);' onblur='doblur(this);'/></td><td tabindex=0>file3</td> </tr> </table> </form> В результате: focus(file1), focus(file2), focus(file3), А onblur как не было так и нет. |
<script type="text/javascript"> function dofocus(self) {document.body.appendChild(document.createTextNode('focus('+self.name+'),'))} function doblur (self) {document.body.appendChild(document.createTextNode('blur('+self.name+'),'))} </script> <form id="upload" method="post" enctype="multipart/form-data" action="/upload7"> <table> <tr><td><input type="file" name='file1' onfocus='dofocus(this);' onblur='doblur(this);'/><td><input type="button" name='td1' onfocus='dofocus(this);' onblur='doblur(this);'/></td> </tr> <tr><td><input type="file" name='file2' onfocus='dofocus(this);' onblur='doblur(this);'/></td><td><input type="button" name='td2' onfocus='dofocus(this);' onblur='doblur(this);'/></td> </tr> <tr><td><input type="file" name='file3' onfocus='dofocus(this);' onblur='doblur(this);'/></td><td><input type="button" name='td2' onfocus='dofocus(this);' onblur='doblur(this);'/></td> </tr> </table> </form> |
Deff,
чего бы ты не лепил, но тот вариант реально Баг, я отправил репорт в Оперу. Дальше видно будет что к чему. |
devote,
Да баг багом, но обычно прожект доделывают не дожидаясь правки софта? В принципе <button> стилем под div заделать |
Спасибо всем за ответы! Я как раз и с button вариант попробовал.
Мне div нужен как контейнер. В таком div свой контрол нарисован. С рисунками и со своей логикой. И ему нужно фокус принимать. И отдавать конечно тоже. Input не подходит потому что не контейнер. Или я ошибаюсь? Заменил input на button. Вот так: <script type="text/javascript"> function dofocus(self) { document.body.appendChild(document.createTextNode('focus('+self.name+'), ')) } function doblur(self) { document.body.appendChild(document.createTextNode('blur('+self.name+'), ')) } </script> <form action='/'> <table> <tr> <td> <input type="file" name='file1' onfocus='dofocus(this)' onblur='doblur(this)'> <button name='button1' onfocus='dofocus(this)' onblur='doblur(this)'>Button1</button> </td> </tr> <tr> <td> <input type="file" name='file2' onfocus='dofocus(this)' onblur='doblur(this)'> <button name='button2' onfocus='dofocus(this)' onblur='doblur(this)'>Button2</button> </td> </tr> <tr> <td> <input type="file" name='file3' onfocus='dofocus(this)' onblur='doblur(this)'> <button name='button3' onfocus='dofocus(this)' onblur='doblur(this)'>Button3</button> </td> </tr> </table> </form> И снова события onblur нет у <input type=file>. Почему он нужен? <input type=file> на странице невидим и сам находится в div. По-сути этот div - стилизованная кнопка для загрузки файлов. Поэтому что бы его "правильно" нарисовать нужно событие onblur <input type=file>. А его в Opera почему-то нет. |
Часовой пояс GMT +3, время: 19:54. |