<body> <div id="div1" style="display:block;" > <div id="logo"></div> <div id="word1"></div> <div id="word2"></div> <form name="form1" method="get" action="zhengshu.php" onsubmit="return submitCheck();"> -----重点return +函数名实现为空返回原界面------------ <div id="username"> <div id="content"> <input type="text" name="user" id="user" class="bgc" autofocus="autofocus" placeholder="您的姓名" /> <div><img src="images/word3.svg" /></div> </div> </div> <input type="submit" id="sub" value="提交"></div> </form> </div> </body> <script type="text/javascript"> function submitCheck(){ var txt = document.getElementById("user"); if(txt.value==""){ alert("请输入您的姓名"); txt.focus(); return false; } return true; } </script>
<?php $username=$_GET[‘user‘]; -------接收传过来的值 ?> <div id="link"><?php echo $username ?></div>-----输出传过来的值
时间: 2024-09-29 06:23:02