一个简单的html5Demo

<DOCTYPE html>
    <html>
        <head>
        <meta charset="utf-8"/>
        <meta http-equiv=X-UA-Compatible content="IE=edge,chorme=1"/>
        <meta http-equiv="Content-Type" content="text/html" charset="utf-8"/>
        
        <meta name="keywords" content="nihao,haha,anzhuo"/>
        <meta name="description" content="yaiisidsisifsofidsoids我的描述"/>
        <link rel="dns-prefetch" href="//tmm.taobao.com"/>
        <title>Js Demotitle>
        
        <Link rel="shortcut icon" type="image/x-icon" href="images/favricon.ico"/>
        <script type="text/javascript" src="js/jquery-1.8.3/jquery.min.js">script>
        head>
        <body>
        <style type="text/css">
            .hilite{
                background-color:red;
            }
        style>
            <p>This is a paragraph of Htmlp>
            <script type="text/javascript">
                //文档就绪函数在html加载完执行
                $(document).ready(function(){
                    alert("ceshi");
                    debugtwo("ni shuo de sha");
                    var e = document.getElementById("debuglog");
                    highlight(e);
                    //hide(e,false);
                });
                //一个普通函数,里面放置一个方法,加一个if的判断
                function moveon(){
                    var answer =confirm("准备好了么?");
                    if(answer)window.location = "https://www.baidu.com";
                }
                //时间控制调用
                setTimeout(moveon,6000);
                //查找和修改基本文档
                function debug(msg){
                    var log = document.getElementById("debuglog");
                    if(!log){
                        log = document.createElement("div");
                        log.id = "debuglog";
                        log.innerHTML = "

Debug Log

"
; document.body.appendChild(log); } var pre = document.createElement("pre"); var text = document.createTextNode(msg); pre.appendChild(text); log.appendChild(pre); } //jquery下的debug function debugtwo(msg){ var log = $("debuglog"); if(log.length==0){ log=$("

Debug Log

"
); log.appendTo(document.body); } log.append($("
").text(msg));
                }
                //js操纵html来进行css样式制作
                function hide(e,reflow){
                    if(reflow){
                        e.style.display = "none"
                    }else{
                        e.style.visibility = "hidden"
                    }
                }
                //js操纵html来进行css样式显示高亮
                function highlight(e){
                    if(!e.className)e.className = "hilite";
                    else e.className += "hilite";
                }
                //加载函数就绪
                window.onload = function(){
                    var images = document.getElementsByTagName("img");
                    for(var i=0;ivar image =images[i];
                        if(image.addEventListener){
                            image.addEventListener("click",hide,false);
                        }else{
                            image.attachEvent("onclick",hide);
                        }
                    }
                    function hide(event){event.target.style.visibility = "hidden";}
                }

            script>

            <img>sssimg>
            <img>sssimg>
            <img>sssimg>
            <img>sssimg>
            <img>ssimg>
        body>
    html>

你可能感兴趣的:(Java,html)