如何从包含onclick事件的文本中删除突出显示?

时间:2014-07-31 04:06:08

标签: javascript html internet-explorer windows-phone-8 internet-explorer-10

我正在使用在webView for windows phone 8.1中显示这个html代码,我猜这是使用IE 11。

<!DOCTYPE html><html><head><meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0" />
    </head>
    <body>
    <p><font size="4">
    <span id="1" onclick=notify(1)>Man this is awkward.</span>
    <span id="2" onclick=notify(2)> Why is everyone so quite today.</span>
    <span id="3" onclick=notify(3)> Oh please someone talk to me.</span>
    <span id="4" onclick=notify(4)> This silence is intimidating.</span>
    <br><br><br><br></font></p><style>

                    body {
                      -webkit-user-select: none;
                         -moz-user-select: -moz-none;
                          -ms-user-select: none;
                              user-select: none;
                    }
                    </style><script>
                    function notify(val)
                    {
                         window.external.notify(val.toString());
                    } 
                    </script></body></html>

但是当我点击任何一行时,整行都会被选中。enter image description here

我想删除此突出显示。有没有办法做到这一点?

1 个答案:

答案 0 :(得分:0)

CSS

outline-style: none; 
-webkit-touch-callout: none;
-webkit-tap-highlight-color: rgba(0,0,0,0);

的JavaScript

document.addEventListener("touchstart", function(){}, true);

触摸开始做什么:

$('body').live(
'touchstart', 
function(e){
    if(e.target.localName != 'select'){
        e.preventDefault(); 
    }
}

如果那不起作用,请检查this。希望有所帮助。

相关问题