前端基础初探

<!DOCTYPE html>
<html>
<head>
    <script src="https://cdn.staticfile.org/jquery/1.8.3/jquery.min.js"></script>
    <script src="https://cdn.bootcdn.net/ajax/libs/fetch/3.0.0/fetch.min.js"></script>
    <style>
        .center {
            margin: auto;
            width: 60%;
            border: 3px solid #73AD21;
            padding: 10px;
        }
    </style>
    <meta charset="utf-8">
    <title>testTheFirst</title>
</head>
<body>
    <!--通过ajx请求数据 -->
    <a href="http://www.runoob.com">这是大标题</a>
    <p>
        队列
        <br>
        看着一般吧,是吧
    </p>

    <div class="center">
        <p>
            你好,我喜欢什么呢
            <br>
            哈哈哈哈哈哈,哈哈哈哈重新排序
        </p>
    </div>
     <script>
         // let promise= new Promise(resolve => {
         //     setTimeout(()=> {
         //         console.log("dfdfdf");
         //         resolve("Hello");
         //     },3000)
         // }); promise定时器,将任务队列化
 
        var tupian1="/Desktop/ji.png";
        var tupian2="/Desktop/erwe.png";

        function test() {
            var url = 'http://127.0.0.1:9200';
            ret = fetch(url).then(function(response) {
                return response.json()
            }).then(function(data) {
                text="<tr>"
                text+="<td>"+data["name"]+"</td>";
                text+="<td>"+data["cluster_name"]+"</td>";
                text+="</tr>";
                document.getElementById('myFormData').innerHTML = text;//展示数据
                return text;
            }).catch(function(err){
                console.log("cuowu")
            });
        }

        function testTupainEnter(obj) {
            obj.src = tupian1;
            return false;
        }
        //定义事件,鼠标在图片上图片就变
        //请求数据,然后进行展示

        function testTupianLeaver(obj) {
            obj.src = tupian2;
            return false;
        }

        function testmaodian(obj) {
            obj.innerHTML="将变化到的";
            return false;
        }

        function testmaodianLeaver(obj) {
            obj.innerHTML = "会变化的";
            return false;
        }
    </script>

    <table style="border:0;margin-bottom: 0px;">
        <thead>
            <tr>
                <td>test</td>
                <td>jinn</td>
            </tr>
        </thead>
        <tbody id='myFormData'></tbody>
    </table>

    <button onclick="test()">请求数据并进行展示</button>

    <p name="maodian" onmouseover="testmaodian(this)" onmouseleave="testmaodianLeaver(this)">会变化的</p>
    
    <img id="tupian" onmouseenter="testTupainEnter(this)" onmouseleave="testTupianLeaver(this)" src="/Desktop/erwe.png" width="400px" height="400px">
</body>
</html>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值