This article mainly introduces how to implement the beautiful search box Effect of YouKu in js. It is very practical to use javascript to combine mouse events and page styles to achieve beautiful search box effects, if you need it, refer to the example in this article to describe how js achieves the beautiful search box of YouKu. Share it with you for your reference. The details are as follows:
Shows the running effect:
The Online Demo address is as follows:
Http://demo.jb51.net/js/2015/js-youku-search-style-codes/
The Code is as follows:
Search entriesScript function drop_mouseover (pos) {try {window. clearTimeout (timer);} catch (e) {}} function drop_mouseout (pos) {var posSel = document. getElementById (pos + "Sel "). style. display; if (posSel = "block") {timer = setTimeout ("drop_hide ('" + pos + "')", 1000) ;}} function drop_hide (pos) {document. getElementById (pos + "Sel "). style. display = "none";} function search_show (pos, searchType, href) {document. getElementById (pos + "Sea RchType "). value = searchType; document. getElementById (pos + "Sel "). style. display = "none"; document. getElementById (pos + "Slected "). innerHTML = href. innerHTML; document. getElementById (pos + 'q '). focus (); var sE = document. getElementById ("searchExtend"); if (sE! = Undefined & searchType = "bar") {sE. style. display = "block";} else if (sE! = Undefined) {sE. style. display = "none";} try {window. clearTimeout (timer) ;}catch (e) {}return false;} script
I hope this article will help you design javascript programs.