php中调用js

1 <?php 
2 echo '<script>var yearid=$("#yearId").val()</script>';
3 echo $yearid='<script>document.write(yearid);</script>';
4 ?>

js中调用php

1 <?php
2 $userId=100;
3 ?>
4  <script>
5 var userId;
6 userId=$("#userId").value;
7 alert (userId);
8 </script>
9 <input type="text" name="userId" >

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-10-19
  • 2021-11-04
猜你喜欢
  • 2022-12-23
  • 2021-12-16
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-09-25
相关资源
相似解决方案