Home > Backend Development > PHP Problem > What is the method for php to call js?

What is the method for php to call js?

青灯夜游
Release: 2023-03-07 06:26:01
Original
3341 people have browsed it

What is the method for php to call js?

Recommended: "PHP Video Tutorial"

PHP calls JS

Value: Display: values;

<html>
<body>
	<script type="text/javascript">
		var str = &#39;values&#39;;
	</script>
	<?php 
		echo "<script type=text/javascript>document.write(str)</script>";
	?>
</body>
</html>
Copy after login

Call function (method) Pop-up window: 9

<html>
<body>
	<script type="text/javascript">
		function add(){
			var x = 0;
			x = x + 9;
			alert(x);
		}
	</script>
	<?php 
		echo "<script type=text/javascript>add()</script>";
	?>
</body>
</html>
Copy after login

Related recommendations: php training

The above is the detailed content of What is the method for php to call js?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template