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>';'; ?> Quote Link to comment 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. Quote Link to comment 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... Quote Link to comment 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 Quote Link to comment 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.... Quote Link to comment 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 Quote Link to comment 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? Quote Link to comment Share on other sites More sharing options...
teamatomic Posted February 21, 2010 Share Posted February 21, 2010 php|txt|html|css HTH Teamatomic Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.