现在的位置: 首页 > 综合 > 正文

手写板 (调用百度接口)

2017年12月07日 ⁄ 综合 ⁄ 共 1141字 ⁄ 字号 评论关闭

<!doctype html>
 <html>
 <head>
 <title>落日赌城</title>
 <style>
 #sx{color:#00C;text-decoration:underline;cursor:pointer;}
 </style>
 </head>
 <body>
 <form name="f" action="s">
 <input type="text" name="wd" id="kw" maxlength="100">
 <input type="submit" value="" id="su">
 <span id="sx">手写</span>
 </form>
 <script> 
 var w = window,d = document,n = navigator,k = d.f.wd
 if (w.attachEvent) {
     w.attachEvent("onload", function() {k.focus();})
 } else {
     w.addEventListener('load', function() {k.focus()},true)
 };
 var hw = {};
 hw.i = d.getElementById("sx");
 var il = false;
 if (/msie (\d+\.\d)/i.test(n.userAgent)) {
     hw.i.setAttribute("unselectable", "on")
 } else {
     var sL = k.value.length;
     k.selectionStart = sL;
     k.selectionEnd = sL
 }
 hw.i.onclick = function(B) {
     var B = B || w.event;
     B.stopPropagation ? B.stopPropagation() : (B.cancelBubble = true);
     if (d.selection && d.activeElement.id && d.activeElement.id == "kw") {
         hw.hasF = 1
     } else {
         if (!d.selection) {
             hw.hasF = 1
         }
     }
     if (!il) {
         var A = d.createElement("script");
         A.setAttribute("src", "http://www.baidu.com/hw/hwInput.js"); 
         d.getElementsByTagName("head")[0].appendChild(A);
         il = true;
     }
 }; 
 </script>
 <br />
 
 </body>
 </html>

抱歉!评论已关闭.