Write a popup box with native js

I believe that in the usual front-end writing process, if you want to pop up a box, you can use the simplest alert statement. Then if you want to leave the back-end and the database aside, how to implement a pop-up box with only native js and this The pop-up box will automatically add things to you? You need to write two html. First:
<!DOCTYPE HTML>
<html>
<head>
  <meta charset='utf-8'>
  <script src="https://cdn.bootcss.com/jquery/3.2.1/jquery.js"></script>
</head>
<body>
    <div class='wrap'>
        <input id='name'  type='text'>
    <div class='button'>Pass</div>
    <script>
        var oName=document.querySelector('#name');
        var val = '';
        var oBtn=document.querySelector('.button');
        var Url=location.href;
        var str=Url.replace(/start\.html/,'end.html')
        console.log(str)
        oBtn.onclick=function(){
            val=oName.value;
            console.log(location.href);
            window.open(str+'?code='+val);
}
    </script>
</body>
</html>
 Second page:
<!DOCTYPE HTML>
<html>
<head>
<meta charset='utf-8'>
<script src="https://cdn.bootcss.com/jquery/3.2.1/jquery.js"></script>
</head>
<body>
<script>
    window.onload=function(){
       var Url=location.href;
       var name=decodeURI(Url.match(/code=(\S*)/)[1])
       alert(name+'I love you')
}
</script>
</body>
</html>
 

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326677863&siteId=291194637