JavaScript code";"."/> JavaScript code";".">

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

What is the method for php to call js?

青灯夜游
青灯夜游Original
2020-11-03 12:15:383325browse

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>

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>

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!

Statement:
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