Jump to content

[SOLVED] Problem with javascript/php


dc_jt

Recommended Posts

Hi

 

Can someone explain to me why this wont work please?:

 

echo '<img id="1" class="items"  src="../assets/images/cookie.gif" />';
                    echo '<script type="text/javascript">';
				echo '//<![CDATA[';
				echo 'new Draggable("1", {revert:\'true\'})';
				echo '//]]>';
				echo '</script>';

Thanks

 

Link to comment
https://forums.phpfreaks.com/topic/89731-solved-problem-with-javascriptphp/
Share on other sites

You may have to put things on new line especially if you have comment in your code.

<?php
echo "<img id=\"1\" class=\"items\"  src=\"../assets/images/cookie.gif\" />\n";
echo "  <script type=\"text/javascript\">\n";
				echo "//<![CDATA[\n";
				echo "new Draggable(\"1\", {revert:'true'})\n";
				echo "//]]>\n";
				echo "</script>\n";
?>

 

Ray

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.