对象焦点问题,Safari和Chrome浏览器 [英] Object Focus problem with Safari and Chrome browsers

查看:247
本文介绍了对象焦点问题,Safari和Chrome浏览器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下的javascript被调用时,页面加载请求焦点。

这code ++工程,100%与Firefox和IE7,而Chrome和Safari OK似乎并没有将焦点可言。如何使其与所有浏览器?

 的document.getElementById(MyFlashFile)专注()。
 

解决方案

确保该code被称为全部页已经被渲染后。它可能被调用它上面指的是HTML,所以该元素将不会存在。

各种JavaScript框架有工具来告诉你的 DOM就绪

I have the following javascript being called to request a focus when page is loaded.

This code works 100% OK with Firefox and IE7, but Chrome and Safari do not seem to move the focus at all. How to make it work with all browsers?

 document.getElementById("MyFlashFile").focus();

解决方案

Ensure this code is being called after the entire page has been rendered. It's probably being called above the HTML it refers to, so the element will not exist yet.

Various JavaScript frameworks have utilities to tell you when the DOM is ready.

这篇关于对象焦点问题,Safari和Chrome浏览器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆