首页 > 其他分享 >基于html,css,js,jQuery,ajax实时天气的网页

基于html,css,js,jQuery,ajax实时天气的网页

时间:2024-06-17 20:30:52浏览次数:29  
标签:jQuery now color daily height width ajax let js

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" href="./css/index.css">
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/font/qweather-icons.css">
    <title>Document</title>
</head>

<body>
    <div class="video-background">
        <video autoplay loop muted>
            <source src="./video/a0.mp4" type="video/mp4">
        </video>
    </div>
    <div class="head">
        <div class="nav clearfix">
            <div class="nav-left">
                全国城市天气预报
            </div>
            <div class="nav-moid">
                <ul id="myList">
                    <li>首页</li>
                    <li><a href="./index.html">今日天气</a></li>
                    <li><a href="./map.html">城市数据</a></li>
                    <li><a href="./coldy.html">气象热点</a></li>
                    <li>联系我们</li>
                </ul>
            </div>
            <div class="nav-right">
                <img src="./images/Coldy/weizhi.png" alt="" srcset="">
                <span id="span1">青岛</span>
                <input type="text" id="myInput">
                <button onclick="updateSpan()">切换</button>
            </div>
        </div>
    </div>

    <!-- 展开 -->
    <div class="shows">
        <div class="show">
            <ul class="tabs">
                <li data-tab="tab-1" class="tab-link">今日天气</li>
                <li data-tab="tab-2" class="tab-link">未来三天</li>
                <li data-tab="tab-3" class="tab-link">空气质量</li>
                <li data-tab="tab-4" class="tab-link">温馨提示</li>
            </ul>
        </div>
        <div class="shopen">
            <span>展</span>
            <span>开</span>
        </div>
    </div>

    <div class="tab-content">
        <!-- 今日天气 -->
        <div class="tab-panel" id="tab-1">
            <div class="content">
                <div class="b-lef">
                    <div class="city">
                        <p class="t-city"><span id="span2">青岛</span> 今日天气</p>
                    </div>
                    <div class="cldy">
                        <p class="el-time"></p>
                        <div class="csd">
                            <span class="temp"></span>
                            <img class="cl-img" src="./images/icon/101.png" alt="">

                        </div>
                        <div class="shes">  
                            <span class="temin"></span>  
                            ~<span class="temax"></span>  
                        </div> 
                        <ul>
                            <li>天气:<span class="coldy"></span></li>
                            <li>空气质量:<span class="cate"></span></li>
                            <li>风向:<span class="wind"></span></li>
                            <li>风力:<span class="winsc"></span>级</li>
                        </ul>


                        <p class="el-tit">温馨提示</p>
                        <p class="expict"></p>
                    </div>
                </div>
                <div class="b-rig">
                    <ul>
                        <li class="name"></li>
                        <li class="cade"></li>
                    </ul>
                    <ul>
                        <li class="name"></li>
                        <li class="cade"></li>
                    </ul>
                    <ul>
                        <li class="name"></li>
                        <li class="cade"></li>
                    </ul>
                    <ul>
                        <li class="name"></li>
                        <li class="cade"></li>
                    </ul>
                    <ul>
                        <li class="name"></li>
                        <li class="cade"></li>
                    </ul>
                    <ul>
                        <li class="name"></li>
                        <li class="cade"></li>
                    </ul>
                </div>
            </div>
        </div>
        <!-- 未来三天 -->
        <div class="tab-panel" id="tab-2">
            <div class="fun">
                <div class="today">
                    <span>今天</span>
                    <span class="new-t"></span>
                    <img class="coimg">
                    <span class="shesd"></span>
                    <span class="winds"></span>
                    <span class="tems"></span>
                </div>
                <div class="today">
                    <span>明天</span>
                    <span class="new-t"></span>
                    <img class="coimg">
                    <span class="shesd"></span>
                    <span class="winds"></span>
                    <span class="tems"></span>
                </div>
                <div class="today">
                    <span>后天</span>
                    <span class="new-t"></span>
                    <img class="coimg">
                    <span class="shesd"></span>
                    <span class="winds"></span>
                    <span class="tems"></span>
                </div>
            </div>
        </div>
        <div class="tab-panel" id="tab-3">
            <div class="fun">
                空气质量空气质量空气质量
            </div>

            </div>
        <div class="tab-panel" id="tab-4">
            <div class="fun"> 温馨提示温馨提示</div>
           
        </div>

        <div class="footer">
            <div class="foot">
                <span>备案号:鲁ICP备20000563号</span>
                <span>数据来源:和风天气</span>
            </div>
        </div>
        <script src="./js/code.jquery.com_jquery-3.7.1.js"></script>
        <script src="./js/echarts.js"></script>
        <script src="./js/index.js"></script>
        <script>

        </script>
</body>

</html>
* {
    margin: 0;
    padding: 0;
}

.head {
    width: 100%;
    height: 60px;
    color: white;
    background-color: rgba(0, 0, 0, 0.3)
}


.nav {
    width: 80%;
    margin: 0 auto;
}

.clearfix:after {
    content: ".";
    display: block;
    clear: both;
    visibility: hidden;
}

.nav-left {
    float: left;
    width: 25%;
    height: 60px;
    line-height: 60px;
    text-align: center;
}

.nav-moid {
    width: 65%;
}

.nav-moid li {
    list-style: none;
    font-size: 14px;
    float: left;
    position: relative;
    height: 60px;
    line-height: 60px;
    text-align: center;
    padding: 0 20px;

}

.nav ul li:hover {
    background-color: rgba(0, 0, 0, 0.5);
}

.nav ul li a {
    color: white;
    text-decoration: none;
}

/* .nav-moid ul li:nth-child(2){
    background-color: rgba(0, 0, 0, 0.5);
} */
.nav-right {
    float: right;
    position: relative;
    padding-top: 12px;
    font-size: 14px;
}
.nav-right img{
    position: absolute;
    top: 16px;
    left: -26px;
    display: inline-block;
    width: 24px;
    height: 24px;
    
}
.nav-right input {
    height: 28px;

}

.nav-right button {
    height: 32px;
    width: 46px;
    border: none;
    background-color: #4c4c4c;
    color: white;
}

/* 展开 */
.shows {
    position: fixed;
    top: 30%;
    left: -100px;
    display: flex;
    height: 280px;
    width: 128px;
}

.shopen {
    position: relative;
    top: 36%;
    left: 0;
    height: 80px;
    width: 28px;
    color: white;
    background-color: rgb(22, 131, 177);
}

.shopen span {
    display: block;
    padding: 10px 6px;
}

.show {
    height: 280px;
    width: 100px;
    background-color: rgba(140, 140, 140, 0.3);
    /* display: none; */
}

.show ul li {
    list-style-type: none;
    height: 70px;
    width: 100%;
    line-height: 70px;
    text-align: center;
    color: white;
}

.show ul li:hover {
    cursor: pointer;
    background-color: rgba(0, 0, 0, 0.3);
}

/* 今日天气 */

.content {
    margin: 100px auto;
    width: 60%;
    display: flex;
}

.b-lef {
    width: 300px;
    height: 400px;
    color: white;
    border: 1px solid skyblue;
    border-radius: 12px;
    /* background: red; */
}

.b-lef:hover {
    transform: scale(1.2);
}

.b-lef .city {
    width: 300px;
    height: 40px;
    line-height: 40px;
    text-align: center;
    border-top-left-radius: 10px;
    border-top-right-radius: 10px;
    background-color: skyblue;
}

.b-lef .cldy {
    height: 360px;
    background-color: rgba(130, 130, 130, 0.3);
}

/* 时间戳 */
.b-lef .el-time {
    width: 300px;
    height: 50px;
    line-height: 50px;
    text-align: center;
    font-size: 16px;
}

.b-lef .csd {
    width: 100%;
    height: 100px;
    line-height: 150px;
    text-align: center;
}
.temp{
    font-size: 32px;
}
.csd img {
    width: 80px;
    height: 80px;
}

.b-lef .shes {
    width: 100%;
    height: 30px;
    line-height: 30px;
    padding: 0 0;
    text-align: center;
}

.temin {
    font-size: 28px;
    /* 举例,设置较大的字体大小 */
}

.temax {
    font-size: 12px;
    /* 举例,设置较小的字体大小 */
}

.b-lef ul {
    height: 80px;
    width: 100%;
}

.b-lef .cldy ul li {
    width: 50%;
    height: 40px;
    float: left;
    font-size: 14px;
    list-style: none;
    line-height: 40px;
    text-align: center;
}

.b-lef .cldy ul li:hover {
    border-radius: 10px;
    background-color: rgba(0, 0, 0, 0.3);
}

.b-lef .el-tit {
    width: 100%;
    height: 30px;
    font-size: 14px;
    line-height: 30px;
    text-align: center;
}

.b-lef .expict {
    width: 100%;
    height: 60px;
    font-size: 14px;
    line-height: 25px;
    text-indent: 2em;
}

.b-lef .expict:hover {
    border-radius: 10px;
    background-color: rgba(0, 0, 0, 0.3);
}

.b-rig {
    width: 420px;
    height: 400px;
    padding: 80px;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-around;
}

.b-rig ul:hover {
    transform: scale(1.2);
}

.b-rig ul {
    width: 112px;
    height: 80px;
    list-style: none;
}

.b-rig ul li {
    width: 112px;
    height: 40px;
    color: white;
    line-height: 40px;
    text-align: center;
}

.b-rig ul li:nth-child(1) {

    background-color: rgba(0, 0, 0, 0.4);

}

.b-rig ul li:nth-child(2) {
    background-color: rgba(128, 128, 128, 0.3);

}

/* tab切换 */
.tab-panel {
    display: none;
}

.tab-panel:first-child {
    display: block;
}

.tab-link.active {
    /* 这里添加选中Tab的样式,如背景色、边框等 */
    background-color: rgba(128, 128, 128, 0.3);
}

/* 未来三天 */
.fun {
    margin: 150px auto;
    width: 60%;
    height: 260px;
    /* background-color: blue; */
    display: flex;
    color: white;
    font-size: 16px;
    justify-content: space-around;
}

.fun .today {
    width: 30%;
    height: 100%;
    padding: 20px 0;
    background-color: rgba(255, 255, 255, 0.4);
}

.fun span {
    display: inline-block;
    width: 100%;
    height: 30px;
    line-height: 30px;
    text-align: center;
}

.fun ul li {
    list-style-type: none;
}

.fun img {
    margin: 0 87px;
    width: 100px;
    height: 100px;
}
  
/* 尾部 */
.footer {
    width: 100%;
    height: 40px;
    color: white;
    background-color: rgba(0, 0, 0, 0.3);
    position: fixed;
    bottom: 0;
}

.foot {
    margin: 0 auto;
    width: 25%;
    height: 40px;
    line-height: 40px;
    text-align: center;
}

.footer span {
    font-size: 14px;
    color: #9a9a9a;
    padding: 0 8px;
}
/*背景视频*/
.video-background {  
    position: fixed; /* 使视频背景固定在视口上 */  
    top: 0;  
    right: 0;   
    bottom: 0;   
    left: 0; 
    z-index: -100; /* 确保视频背景在内容下方 */  
    overflow: hidden; /* 隐藏超出容器的部分 */  
}  
  
.video-background video {  
    /* 确保视频覆盖整个容器 */  
    width: 100%;  
    height: 100%;  
    object-fit: cover; /* 保持视频的宽高比,同时填充整个容器 */  
}
// 导航

let xhg = new XMLHttpRequest();
xhg.open('GET', 'https://geoapi.qweather.com/v2/city/lookup?key=5d967db598cd49efbd15bbca6314559b&location=101120201');
xhg.send();
xhg.onreadystatechange = function () {
    if (xhg.readyState == 4) {
        let a = JSON.parse(xhg.responseText);
        console.log(a);
        console.log(a.location[0].id);
        $("t-city").html(a.location[0].name);
        // 获取城市天气
        let xhrx = new XMLHttpRequest();
        xhrx.open('GET', 'https://devapi.qweather.com/v7/weather/now?key=5d967db598cd49efbd15bbca6314559b&location=' + a.location[0].id);
        xhrx.send();
        xhrx.onreadystatechange = function () {
            if (xhrx.readyState == 4) {
                let b = JSON.parse(xhrx.responseText);
                console.log(b);
                $(".temp").html(b.now.temp + "℃");

                $(".coldy").html(b.now.text);
                $(".wind").html(b.now.windDir);
                $(".winsc").html(b.now.windScale);
                $('.cl-img').attr('src', './images/icon/'+b.now.icon+'.png') ;
                // 空气质量
                let xhrq = new XMLHttpRequest();
                xhrq.open('GET', 'https://devapi.qweather.com/v7/air/now?key=5d967db598cd49efbd15bbca6314559b&location=' + a.location[0].id);
                xhrq.send();
                xhrq.onreadystatechange = function () {
                    if (xhrq.readyState == 4) {
                        let c = JSON.parse(xhrq.responseText);
                        console.log(c);
                        $(".cate").html(c.now.category);

                    }
                }
                //天气指数
                let xhrw = new XMLHttpRequest();
                xhrw.open('GET', 'https://devapi.qweather.com/v7/indices/1d?type=1,2,3,4,16,6&key=5d967db598cd49efbd15bbca6314559b&location=' + a.location[0].id);
                xhrw.send();
                xhrw.onreadystatechange = function () {
                    if (xhrw.readyState == 4) {
                        let d = JSON.parse(xhrw.responseText);
                        console.log(d);
                        for (let i = 0; i < d.daily.length; i++) {
                            document.querySelectorAll(".b-rig .name")[i].innerText = d.daily[i].name;
                            // $(".b-rig .name").html(d.daily[i].name);
                            $(".b-rig .cade").html(d.daily[i].category);
                           
                        } 
                        $(".expict").html(d.daily[2].text);
                    }
                }
                let xhz = new XMLHttpRequest();
                xhz.open('GET', 'https://devapi.qweather.com/v7/weather/3d?key=5d967db598cd49efbd15bbca6314559b&location=' + a.location[0].id);
                xhz.send();
                xhz.onreadystatechange = function () {
                    if (xhz.readyState == 4) {
                        let e = JSON.parse(xhz.responseText);
                        console.log(e); 
                        let shesElements = document.querySelectorAll(".shes");   
                        let tempMinElement = shesElements[0].querySelector(".temin");
                        let tempMaxElement = shesElements[0].querySelector(".temax");
                        // 设置文本内容  
                        tempMinElement.innerText = e.daily[0].tempMin;
                        tempMaxElement.innerText = e.daily[0].tempMax + "℃";   
                        for (let s = 0; s < e.daily.length; s++) {
                            document.querySelectorAll(".new-t")[s].innerText = e.daily[s].textDay;
                            document.querySelectorAll(".coimg")[s].setAttribute("src", `./images/icon/${e.daily[s].iconDay}.png`);
                            document.querySelectorAll(".shesd")[s].innerText = `${e.daily[s].tempMin}℃~${e.daily[s].tempMax}℃`;
                            document.querySelectorAll(".winds")[s].innerText = `${e.daily[s].windDirDay} ${e.daily[s].windScaleNight}级`;
                            document.querySelectorAll(".tems")[s].innerText = `湿度:${e.daily[s].humidity}`;

                            
                           
                        }


                    }


                }

            }
        }

    }

}
let inp = document.querySelector("input")
let btn = document.querySelector("button")
btn.onclick = function () {
    let xhr = new XMLHttpRequest();
    xhr.open('GET', 'https://geoapi.qweather.com/v2/city/lookup?key=5d967db598cd49efbd15bbca6314559b&location=' + inp.value);
    xhr.send();
    xhr.onreadystatechange = function () {
        if (xhr.readyState == 4) {
            let a = JSON.parse(xhr.responseText);
            console.log(a);
            console.log(a.location[0].id);
            $("t-city").html(a.location[0].name);
            // $("t-city").innerText(a.location[0].adm2);
            // 获取城市天气
            let xhrx = new XMLHttpRequest();
            xhrx.open('GET', 'https://devapi.qweather.com/v7/weather/now?key=5d967db598cd49efbd15bbca6314559b&location=' + a.location[0].id);
            xhrx.send();
            xhrx.onreadystatechange = function () {
                if (xhrx.readyState == 4) {
                    let b = JSON.parse(xhrx.responseText);
                    console.log(b);
                    $(".temp").html(b.now.temp + "℃");
                    $(".coldy").html(b.now.text);
                    $(".wind").html(b.now.windDir);
                    $(".winsc").html(b.now.windScale);
                    $('.coimg').attr('src', './images/icon/'+b.now.icon+'.png') ;
                    // 空气质量
                    let xhrq = new XMLHttpRequest();
                    xhrq.open('GET', 'https://devapi.qweather.com/v7/air/now?key=5d967db598cd49efbd15bbca6314559b&location=' + a.location[0].id);
                    xhrq.send();
                    xhrq.onreadystatechange = function () {
                        if (xhrq.readyState == 4) {
                            let c = JSON.parse(xhrq.responseText);
                            console.log(c);
                            $(".cate").html(c.now.category);

                        }
                    }
                    //天气指数
                    let xhrw = new XMLHttpRequest();
                    xhrw.open('GET', 'https://devapi.qweather.com/v7/indices/1d?type=1,2,3,4,16,6&key=5d967db598cd49efbd15bbca6314559b&location=' + a.location[0].id);
                    xhrw.send();
                    xhrw.onreadystatechange = function () {
                        if (xhrw.readyState == 4) {
                            let d = JSON.parse(xhrw.responseText);
                            console.log(d);
                            for (let i = 0; i < d.daily.length; i++) {
                                document.querySelectorAll(".b-rig .name")[i].innerText = d.daily[i].name;
                                // $(".b-rig .name").html(d.daily[i].name);
                                $(".b-rig .cade").html(d.daily[i].category);

                            }
                        }
                    }
                    // 未来天气
                    let xhz = new XMLHttpRequest();
                    xhz.open('GET', 'https://devapi.qweather.com/v7/weather/3d?key=5d967db598cd49efbd15bbca6314559b&location=' + a.location[0].id);
                    xhz.send();
                    xhz.onreadystatechange = function () {
                        if (xhz.readyState == 4) {
                            let e = JSON.parse(xhz.responseText);
                            console.log(e);
                            for (let s = 0; s < e.daily.length; s++) {
                                document.querySelectorAll(".new-t")[s].innerText = e.daily[s].textDay;
                                document.querySelectorAll(".coimg")[s].setAttribute("src", `./images/icon/${e.daily[s].iconDay}.png`);
                                document.querySelectorAll(".shesd")[s].innerText = `${e.daily[s].tempMin}℃~${e.daily[s].tempMax}℃`;
                                document.querySelectorAll(".winds")[s].innerText = `${e.daily[s].windDirDay} ${e.daily[s].windScaleNight}级`;
                                document.querySelectorAll(".tems")[s].innerText = `湿度:${e.daily[s].humidity}`;
                                
                                // $('.coimg').attr('src', './images/icon/'+b.now.icon+'.png') 
                                //      $(".new-t").html(f.daily[0].updateTime);
                                // $(".te-col").html(f.daily[0].textDay);
                            }


                        }
                    }

                }

            }
        }

    }
    var inputValue = document.getElementById('myInput').value;

    // 如果 input 有值,则更新 span 的内容
    if (inputValue !== '') {
        // 获取 span 元素并设置其文本内容为 input 的值
        var spanIds = ['span1', 'span2', 'span3'];
        spanIds.forEach(function (id) {
            var spanElement = document.getElementById(id);
            spanElement.textContent = inputValue;
        });
    }
}
// //span更新
// btn.onclick = function updateSpan() {
//     // 获取 input 元素的值
//     var inputValue = document.getElementById('myInput').value;

//     // 如果 input 有值,则更新 span 的内容
//     if (inputValue !== '') {
//         // 获取 span 元素并设置其文本内容为 input 的值
//         var spanIds = ['span1', 'span2', 'span3'];  
//         spanIds.forEach(function(id) {  
//             var spanElement = document.getElementById(id);  
//             spanElement.textContent = inputValue;  
//         });  
//     }
//     // 注意:这里不设置默认值,因为 span 已经在 HTML 中被设置为 "青岛"
// }


// https://api.qweather.com/airquality/v1/now/{LocationID}?

// 时间戳
function showTime() {
    let now = new Date();
    let year = now.getFullYear(); // 返回年份  
    let month = now.getMonth() + 1;
    let day = now.getDate();
    let dayNames = ['日', '一', '二', '三', '四', '五', '六'];
    let dayOfWeek = dayNames[now.getDay()]; // 获取星期几  
    let hours = now.getHours();
    let minutes = now.getMinutes();
    let seconds = now.getSeconds();
    month = month < 10 ? '0' + month : month;
    day = day < 10 ? '0' + day : day;
    hours = (hours < 10) ? "0" + hours : hours;
    minutes = (minutes < 10) ? "0" + minutes : minutes;
    seconds = (seconds < 10) ? "0" + seconds : seconds;

    // 拼接时间字符串,包括星期几  
    let timeString = year + "年" + month + "月" + day + "日" + "星期" + dayOfWeek + hours + ":" + minutes + ":" + seconds;
    $(".el-time").text(timeString); // 使用jQuery的.text()方法来设置内容  

    // 每秒更新一次时间  
    setTimeout(showTime, 1000);
}

// 首次加载时显示时间  
$(document).ready(function () {
    showTime();
});

$(document).ready(function () { // 确保DOM已加载后再调用showTime函数  
    showTime();
});

// 展开
$(".shopen").mouseenter(function () {
    let shows = $(".shows");
    shows.css("left", '0')

});
$(".shows").mouseleave(function () {
    let shows = $(".shows");
    shows.css("left", '-' + 100 + 'px')
});

// tab切换
document.addEventListener('DOMContentLoaded', function () {
    // 获取所有的Tab链接和内容面板
    var tabLinks = document.querySelectorAll('.tab-link');
    var tabPanels = document.querySelectorAll('.tab-panel');

    // 为每个Tab链接添加点击事件监听器
    tabLinks.forEach(function (tabLink) {
        tabLink.addEventListener('click', function () {
            // 移除所有Tab链接的active类
            tabLinks.forEach(function (link) {
                link.classList.remove('active');
            });

            // 隐藏所有内容面板
            tabPanels.forEach(function (panel) {
                panel.style.display = 'none';
            });

            // 获取当前点击的Tab链接的data-tab属性值
            var tabId = this.getAttribute('data-tab');

            // 为当前Tab链接添加active类,并显示对应的内容面板
            this.classList.add('active');
            document.getElementById(tabId).style.display = 'block';
        });
    });
});




let listItems = document.querySelectorAll('#myList li');  
listItems[1].style.backgroundColor ='rgba(0, 0, 0, 0.3)'; 

页面效果

标签:jQuery,now,color,daily,height,width,ajax,let,js
From: https://blog.csdn.net/m0_64455070/article/details/139753450

相关文章

  • 前端JS必用工具【js-tool-big-box】学习,打开全屏和关闭全屏
    这一小节,我们说一下js-tool-big-box工具库中,打开全屏和关闭全屏的方法学习。我们知道,浏览器想打开全屏,按一下F11键就可以了,但一来这个功能不一定所有使用的用户都知道,二来在一些例如大屏的需求场景下,还是很被需要的。很多用户一旦投屏展示后,他那个大屏幕就在那里给用户展......
  • Java JSON组成和解析
    本框架JSON元素组成和分析,JsonElement分三大类型JsonArray,JsonObject,JsonString。JsonArray:数组和Collection子类,指定数组的话,使用ArrayList来add元素,遍历ArrayList再使用Array.newInstance生成数组并添加元素即可.JsonObject:带有泛型的封装类,给带有泛型的字段赋......
  • 什么是浅拷贝和深拷贝,如何用 js 代码实现?
    〇、简介和对比简介浅拷贝:只复制原始对象的第一层属性值。  如果属性值是值类型,将直接复制值,本值和副本变更互不影响;  如果是引用数据类型,则复制内存地址,因此原始对象和新对象的属性指向相同的内存地址,改变任一值,另一变量值也会同步变更。深拷贝:递归地复制原始对象的所......
  • three.js 从零学习
    基本概念场景用来呈现内容的容器我理解就是类似canvas相机记录场景中呈现的内容一般分类两大类1.正投影相机  所有内容同等大小呈现处理2.透视相机 符合人眼逻辑近大远小渲染器决定场......
  • [JS] 动态执行JS与修改词法作用域
    相关可行的操作eval:同步执行,当前作用域;setTimeout:异步执行,全局作用域;第1个参数可以传入函数对象,也可以传入字符串,即要执行的代码。script:同步执行,全局作用域;创建script标签,并设置innerHTML为要执行的代码。Function:同步执行,全局作用域。Function构造函......
  • js基础文档
    数据类型数据分为基本数据类型(String,Number,Boolean,Null,Undefined,Symbol)和对象数据类型。基本数据类型的特点:直接存储在栈(stack)中的数据引用数据类型的特点:存储的是该对象在栈中引用,真实的数据存放在堆内存里引用数据类型在栈中存储了指针,该指针指向堆中该实体的起......
  • 01- jQuery初始
    1.jQuery简介jQuery是一个快速,小型且功能丰富的JavaScript库。借助易于使用的API(可在多种浏览器中使用),使HTML文档的遍历和操作,事件处理,动画和Ajax等事情变得更加简单。兼具多功能性和可扩展性,jQuery改变了数百万人编写JavaScript的方式。兼容多浏览器的javascript函数库,把我......
  • 04-jQuery工具函数及 jQuery 插件
    1.jQuery工具函数在jQuery中,工具函数是指直接依附于jQuery对象,针对jQuery对象本身定义的方法,即全局性的,我们统称为工具函数,或Utilites函数。主要作用于:字符串、数组、对象。调用格式:$.函数名()或jQuery.函数名()1.1$.get()通过远程HTTPGET请求载入信息。jQue......
  • 基于Vue+Nodejs实现医药商城销售系统
    作者主页:编程指南针作者简介:Java领域优质创作者、CSDN博客专家、CSDN内容合伙人、掘金特邀作者、阿里云博客专家、51CTO特邀作者、多年架构师设计经验、腾讯课堂常驻讲师主要内容:Java项目、Python项目、前端项目、人工智能与大数据、简历模板、学习资料、面试题库、技术互......
  • 获取three.js两点之间的控制点
    首先有两个点: constv0=newTHREE.Vector3(item.x,item.y,item.z);constv3=newTHREE.Vector3(item.target.x,item.target.y,item.target.z);如果想要获取中间点的控制线直接调用方法 getBezierPoint(v0,v3);getBezierPoint(v0,v3){//获取两点的控制点......