比如有这么几句话:PHP Based api creates a tree structure using a couple of small PHP classes如果用户这样选中
PHP Based api creates a tree structure using a couple of small PHP classesstructure只选中部分,js自动把structure整个词选中。变成:
PHP Based api creates a tree structure using a couple of small PHP classes请问如实现?
PHP Based api creates a tree structure using a couple of small PHP classesstructure只选中部分,js自动把structure整个词选中。变成:
PHP Based api creates a tree structure using a couple of small PHP classes请问如实现?
<html>
<head>
<title>文本选中</title>
<script type="text/javascript">
function selectItem(){
var range = document.selection.createRange();
range.moveStart('word',1);
range.moveStart('word',-1);
range.moveEnd('word',-1);
range.moveEnd('word',1);
range.select();
}
</script>
</head>
<body onMouseUp ="selectItem()">
<div id="myDiv" >
PHP Based api creates a tree structure using a couple of small PHP classes
</div>
</body>
</html>