阅读:2175回复:5
怎么用usercontent.css改写ciba的查词页面,自动聚焦到查词框里面
http://wap.iciba.com/
怎么使用usercontent.css改写 这个页面,, 当打开页面的时候,光标 自动聚焦到查词框里面,,回车查完一个单词后,也自动聚焦到查词框里面 重点是能实现 回车查完一个单词后,自动聚焦到查词框里面 求高手帮忙 |
|
最新喜欢:infini... |
1楼#
发布于:2013-06-29 22:44
我自己顶一次吧,,看来这个比较烦,没人帮忙改
|
|
2楼#
发布于:2013-06-29 22:44
据我所知,使用 usercontent.css 无法完成该要求。
可以使用 User 脚本来完成这个要求。 |
|
|
3楼#
发布于:2013-06-29 22:44
我用 gm 脚本尝试了下,用 foucs() 没效果。
|
|
4楼#
发布于:2013-06-29 22:44
hzzhaiqi:我用 gm 脚本尝试了下,用 foucs() 没效果。回到原帖 添加的时机要对,还可以添加一个 setTimeout。 以下脚本代码在 Scriptish 测试可用(由于 pentadactyl 扩展禁止了 autofocus,故与该扩展不兼容): // ==UserScript== // @id autoFocus@iciba.com // @name autofocus search input // @version 1.0 // @namespace http://wap.iciba.com // @author zbinlin // @description // @include http://wap.iciba.com/* // @run-at document-start // ==/UserScript== "use strict"; (function (window) { var document = window.document; window.addEventListener("DOMContentLoaded", function AF_handleEvent(evt) { var word = document.getElementById("word"); if (word) { word.autofocus = true; word.parentNode.replaceChild(word, word); } //window.setTimeout(function () { // word && word.focus(); //}, 100); window.removeEventListener("DOMContentLoaded", AF_handleEvent, true); }, true); }(unsafeWindow || window.wrappedJSObject || window)); |
|
|
5楼#
发布于:2013-06-29 22:44
|
|