3 - linzhig/js.dm GitHub Wiki

<html lang="en"> &lt;head&gt; &lt;meta /&gt; &lt;meta /&gt; &lt;meta /&gt; &amp;lt;title&amp;gt;Document&amp;lt;/title&amp;gt; &amp;lt;style&amp;gt; #box&amp;#123; width: 100px; height: 100px; background: rgb(23, 97, 158); &amp;#125; &amp;lt;/style&amp;gt; &amp;lt;script src=&amp;quot;../JS\1.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt; &lt;/head&gt; &lt;body&gt; &lt;div id=&quot;box&quot; style=&quot;width: 200px;&quot;&gt; &lt;p&gt;123&lt;/p&gt; &lt;/div&gt; &amp;lt;script&amp;gt; //var 全局变量 会成为window属性 //let 叫做 变量 // const 常量 //div .有个事件 = 记录事件 // document.getElementById(&amp;quot;box&amp;quot;).onclick = function () &amp;#123; // document.getElementById(&amp;quot;box&amp;quot;).innerHTML = 'ssss' // &amp;#125; // let b1 = document.getElementById(&amp;quot;box&amp;quot;); // b1.onmouseover = function () &amp;#123; // b1.style.width = &amp;quot;500px&amp;quot; // console.log(b1.style.width ); // &amp;#125; &amp;lt;/script&amp;gt; &lt;/body&gt; </html>

JS window.onload = function () {

    let p1 = document.getElementById("p1");
    let b1 = document.getElementById("box");
        b1.onmousemove = function () {
        p1.innerHTML = "<a href='https://www.baidu.com'>百度</a>"

} }

⚠️ **GitHub.com Fallback** ⚠️