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" id="userId" value="<?php echo $userId; ?>">