Can I call a js function of an external js source inside echo of php ???
Posted July 16th 2013, 4:14am
I have a js file name js_source.js with the function textDisplay() in it.
How can I call this fuction by echo of php?
I try
<?php
echo "<script src='script/js_source.js'>textDisplay();</script>";
?>

It doesn't work
φ
Posts: 35
Joined: May 23rd 2013, 9:51pm
Likes Received: 1
Can I call a js function of an external js source inside echo of php ???
Posted July 16th 2013, 10:20am
You can't place code inside a <script> tag that defines an external script. You'll need something like this:

<?php
echo '<script type="text/javascript" src="script/js_source.js"></script><script type="text/javascript">textDisplay();</script>';
?>
φ
Posts: 1600
Joined: March 12th 2009, 11:00pm
Location: Uncertain due to momentum
Likes Given: 26
Likes Received: 357
Can I call a js function of an external js source inside echo of php ???
Posted July 16th 2013, 10:28pm
Yes, separate the tag if careful, but not the key point.
After doing so, you can see it still dosen't work
φ
Posts: 35
Joined: May 23rd 2013, 9:51pm
Likes Received: 1

Who is online

Users browsing this forum: No registered users and 1 guest