Tip: you can modify some code before running
<!DOCTYPE html><html><head><meta http-equiv="X-UA-Compatible" content="IE=7"><meta http-equiv="content-type" content="text/html;charset=gb2312"><title></title><style>p{font-size:13px;line-height:2}</style></head><body><!-- 准备通过程序动态添加提示功能的input --><p>Your input box:<input id="ipt1" type="text" >Currently selected text:</p></body><!-- 百度搜索框提示 --><script charset="gbk" src="http://www.baidu.com/js/opensug.js"></script><!-- 程序示例 --><script type="text/javascript">Var txtObj = document. getElementById ("alertSpan"); // callback function, used to obtain the currently selected text function show (str) {txtObj. innerHTML = str;} var params = {"XOffset": 0, // horizontal offset of the prompt box position, unit: px "YOffset": 0, // vertical offset of the prompt box position, unit: px "width": 204, // The width of the prompt box, unit: px "fontColor": "# f70", // the text color of the prompt box "fontColorHI": "# FFF ", // text color "fontSize": "12px", // text size "fontFamily": "", // text font "borderColor": "gray ", // the border color of the prompt box "bgcolorHI": "# 03c", // The highlighted color of the prompt box "sugSubmit": false // whether to submit the form when selecting the prompt entry }; baiduSuggestion. bind ("ipt1", params, show );</script></html></td> </tr></table>
Tip: you can modify some code before running