jkost Posted February 20, 2010 Share Posted February 20, 2010 Hi i would like to try this and see how it behaves..but maybe i'm doing something wrong and it's not working. <?php echo '<SCRIPT LANGUAGE="JavaScript"><!--'; echo 'var message = 'Sorry, image saving not allowed.' ;'; echo 'function clickie() {'; echo ' if (document.all) { '; echo ' alert(message);'; echo 'return false; } }'; echo 'function clickns(e) {'; echo 'if (document.layers||(document.getElementById&&!document.all)) {'; echo 'if (e.which==2 || e.which==3) {'; echo 'alert(message);'; echo 'return false; } } }'; echo 'if (document.layers) {'; echo 'document.captureEvents(Event.MOUSEDOWN);'; echo 'document.onmousedown=clickns; '; echo '} else {'; echo 'document.onmouseup=clickns;'; echo 'document.oncontextmenu=clickie;'; echo '}'; echo '// -->'; echo '</SCRIPT>';'; ?> Link to comment https://forums.phpfreaks.com/topic/192707-help-me-include-this-javascript-to-php/ Share on other sites More sharing options...
khr2003 Posted February 20, 2010 Share Posted February 20, 2010 why don't you include it as a simple javascript code without the echo command. Link to comment https://forums.phpfreaks.com/topic/192707-help-me-include-this-javascript-to-php/#findComment-1015176 Share on other sites More sharing options...
jkost Posted February 21, 2010 Author Share Posted February 21, 2010 it doen't work the way you propose... Link to comment https://forums.phpfreaks.com/topic/192707-help-me-include-this-javascript-to-php/#findComment-1015520 Share on other sites More sharing options...
teamatomic Posted February 21, 2010 Share Posted February 21, 2010 Are you saying its not possible for you to break out of php, place the js and then get back into php again? If so, why not? HTH Teamtomic Link to comment https://forums.phpfreaks.com/topic/192707-help-me-include-this-javascript-to-php/#findComment-1015522 Share on other sites More sharing options...
jkost Posted February 21, 2010 Author Share Posted February 21, 2010 the above code must be in a seperate file and it is called with the command "include" but seems i'm having syntax errors and i'm not aware.... Link to comment https://forums.phpfreaks.com/topic/192707-help-me-include-this-javascript-to-php/#findComment-1015523 Share on other sites More sharing options...
teamatomic Posted February 21, 2010 Share Posted February 21, 2010 And what stops you from: include("./this_is_a_js_file.js"); HTH Teamatomic Link to comment https://forums.phpfreaks.com/topic/192707-help-me-include-this-javascript-to-php/#findComment-1015525 Share on other sites More sharing options...
jkost Posted February 21, 2010 Author Share Posted February 21, 2010 And what stops you from: include("./this_is_a_js_file.js"); The php instead of js extension that i was giving to the file... problem solved! thanks for the help! P.S can i do the same if i want to include code CSS? Link to comment https://forums.phpfreaks.com/topic/192707-help-me-include-this-javascript-to-php/#findComment-1015528 Share on other sites More sharing options...
teamatomic Posted February 21, 2010 Share Posted February 21, 2010 php|txt|html|css HTH Teamatomic Link to comment https://forums.phpfreaks.com/topic/192707-help-me-include-this-javascript-to-php/#findComment-1015549 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.