Jump to content

Javascript in PHP help


mayfliesarescary

Recommended Posts

I am really new at using Javascript and PHP.  I read this on how to put javascript into a php document but it really made no sense to me:

 

Answer :

You just echo / print the javascript like you would do with html, like:

 

<? 
echo "<script language=\"JavaScript\">\n"; 
echo "alert("javascript from php");\n"; 
echo "</script>"; 
?> 

 

 

Basically I need this javascript formatted for a PHP document.  Can anyone do this so I can just copy and paste the right code or direct me to a source that can explain this a little better to me?

 

Javascript:

<script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
</script>
<script type="text/javascript">
_uacct = "UA-SAMPLE";
urchinTracker();
</script>

 

Any help would be very much appreciated.

Link to comment
https://forums.phpfreaks.com/topic/46978-javascript-in-php-help/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.