两页代码,想实现传值

<head>
        <title>1.html</title>
    </head>
    <body>
        是否离校:<input type="checkbox" name="" id="" value=""/>
        <button onclick="jump()"></button>
    </body>
    <script type="text/javascript">
        
        function jump() {
            var c = document.getElementsByTagName('input')[0];
            location.href = '2.html?=' + encodeURI(c.value)
        }
    </script>
<head>
        <title></title>
    </head>
    <body>
        <div id="box1">
是否离校:
        </div>


    </body>
    <script type="text/javascript">
        var loc = location.href;
        var n1 = loc.length;
        var n2 = loc.indexOf('=');
        var txt = decodeURI(loc.substr(n2 + 1, n1 - n2));
        var box1 = document.getElementById('box1');
        box1.innerHTML = txt;
    </script>

我勾选checkbox,再点button,跳到第二页,后面显示是
不勾选,则显示否

如有帮助,麻烦点个【采纳此答案】

1.html

<!DOCTYPE html>
<html>
    <head>
            <title>1.html</title>
        </head>
        <body>
            是否离校:<input type="checkbox" name="" id="" value=""/>
            <button onclick="jump()">ddd</button>
        </body>
        <script type="text/javascript">
            function jump() {
                var c = document.getElementsByTagName('input')[0];
                location.href = '2.html?checked=' + c.checked
              
            }
        </script>
</html>


2.html

<!DOCTYPE html>
<html>
    <head>
            <title></title>
        </head>
        <body>
            <div id="box1">
    是否离校:
            </div>
     
        </body>
        <script type="text/javascript">
            var loc = location.href;
            var n1 = loc.length;
            var n2 = loc.indexOf('=');
            var txt = decodeURI(loc.substr(n2 + 1, n1 - n2));
            var box1 = document.getElementById('box1');
            box1.innerHTML = txt=='true'?"是":"否";
        </script>
     
     
</html>