如何選擇使用javascript的整個HTML文檔。選擇HTML文檔的所有文本
我已經嘗試過這些功能,但力量工作!
function SelectAll()
{
document.body.focus();
document.body.select();
}
function SelectAll()
{
document.body.select();
}
我的整個代碼是
<head>
<script type="text/javascript">
function SelectAll()
{
document.body.focus();
document.body.select();
}
</script>
</head>
<body>
<div>LaLa, Lala, laLa , lala, lalala, tralala, some other text</div>
<br />
<input type="text" id="findField" value="lala" size="20" />
<button onclick="SelectAll();">Find!</button>
</body>
試試這個'$( '主體')選擇()' – Amit 2014-09-04 07:26:54
@AmitAgrawal不過,這辛苦工作! – user3873909 2014-09-04 07:42:33