Home > php教程 > php手册 > php 中javascript调用js实例方法

php 中javascript调用js实例方法

WBOY
Release: 2016-05-25 16:46:12
Original
1330 people have browsed it

这三种方法都是从网上找到了,第一种测试可以,后面二种也可以,不过第一次在不同浏览器可能不兼容.

方法一:

echo "document.write(&#39;<script language="javascript" src="/ads/js/$js"></script>&#39;);";
Copy after login

方法二:

echo "var s=document.createelement(&#39;script&#39;);"; 
echo "s.src=&#39;/ads/js/$js&#39;; ";
echo "document.getelementsbytagname(&#39;head&#39;)[0].appendchild(s);";
Copy after login

方法三:

echo "document.write("<scri&#39;+&#39;pt type=&#39;text/javascript&#39; src=&#39;/ads/js/$js&#39;></scr&#39;+&#39;ipt>");";
Copy after login


文章网址:

随意转载^^但请附上教程地址。

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 Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template