SyraTi.ICU

霧雨魔法店 下属

举例来讲

我们现在有一个input#demo

1
<input id="demo" value="attr">

- Attribute和Property都被翻译成“属性”

- “value”就是input#demo的属性之一

- 也就是说,没错,就像你想的一样

- input#demo的 Attribute “value”值为”attr”

- input#demo的 Property “value”值同为”attr”


这时候你可能会问了:什么时候他们不一样?


阅读全文 »

Html


<textarea cols="20" rows="10" id="anyInput">用户定义的代码区域</textarea>
<button type="button" onClick="copy()" value="点击复制代码" />

JS


function copyUrl2()
{
    var target=document.getElementById("anyInput");
    target.select(); // 选择文本
    document.execCommand("Copy"); // 执行浏览器复制命令
    alert("已复制好,可贴粘。");
}