求网页代码:怎么样在网页里把选定的文字自动添加到超链接?
来源:百度知道 编辑:UC知道 时间:2024/05/22 13:21:16
你看看这个能满足你的要求不:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title> New Document </title>
<script type="text\javascript">
<!--
function dosearch()
{
document.selection.createRange();
var searchstr = unescape(document.selection.createRange().text);
if(searchstr != "")
document.location = "http://www.baidu.com/s?wd="+searchstr;
}
//-->
</script>
</head>
<body onmouseup="dosearch()">
哈哈<br>
喜欢<br>
i
</body>
</html>
没懂你说的意思
把你打的字全选中,在点超连接。。。
我认为还不可以,因为在msdn里说ie还不支持slected事件,因而它不会对你的选定作出任何反应!