当前位置: 移动技术网 > IT编程>网页制作>Html5 > 【代码笔记】Web-HTML-脚本

【代码笔记】Web-HTML-脚本

2018年11月07日  | 移动技术网IT编程  | 我要评论

儿子半夜猥琐妈妈,喜妾休夫,赖特菲利普斯

一,效果图。

 

二,代码。

复制代码
<!doctype html>
<html>

<head>
    <meta charset="utf-8">
    <title>html 脚本</title>
</head>

<body>
    <!--插入一段脚本-->
    <script>
    document.write("hello world!");
    </script>
    <!--使用<noscript>标签-->
    <noscript>浏览器不支持javascript的时候显示</noscript>、
    <!--javascript体验-->
    <script type="text/javascript">
    document.write("<h1>这是一个标题</h1>");
    document.write("<p>这是一个段落</p>")
    </script>
    <!--javascript事件响应-->
    <p id="demo">
        javascript can react to events,like the click of a button.
    </p>
    <script type="text/javascript">
    function myfunction() {
        document.getelementbyid("demo").innerhtml = "hello";
    }
    </script>
    <button type="button" onclick="myfunction()">click me</button>
    <!--javascript处理 html 样式-->
    <p id="demo1">javacript能改变html元素的样式.</p>
    <script type="text/javascript">
    function myfunction1() {
        x = document.getelementbyid("demo1");
        x.style.color = "#ff0000";
    }
    </script>
    <button type="button" onclick="myfunction1()">click me</button>
</body>

</html>
复制代码

 

参考资料:《菜鸟教程》

如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复

相关文章:

验证码:
移动技术网