I'm still brand new to PHP and am trying to get javascript into my php script and so far it isn't working for me. I tried a couple things for it and so far no success =[
here is the first script I tried...
<?php
header("Content-Type: text/javascript");
function clickIE4(){
if (event.button==2){
return false;
}
}
function clickNS4(e){
if (document.layers||document.getElementById&&!document.all){
if (e.which==2||e.which==3){
return false;
}
}
}
if (document.layers){
document.captureEvents(Event.MOUSEDOWN);
document.onmousedown=clickNS4;
}
else if (document.all&&!document.getElementById){
document.onmousedown=clickIE4;
}
document.oncontextmenu=new Function("return false")
?>
here is trhe second one I did...
<?php
header("Content-Type: application/x-javascript");
function clickIE4(){
if (event.button==2){
return false;
}
}
function clickNS4(e){
if (document.layers||document.getElementById&&!document.all){
if (e.which==2||e.which==3){
return false;
}
}
}
if (document.layers){
document.captureEvents(Event.MOUSEDOWN);
document.onmousedown=clickNS4;
}
else if (document.all&&!document.getElementById){
document.onmousedown=clickIE4;
}
document.oncontextmenu=new Function("return false")
?>
the script is to disable right click and I tried it on my website plagueinfected.com and nothing worked
any help would be ace
I need a little help
Moderator: General Moderators
- PlagueInfected
- Forum Newbie
- Posts: 9
- Joined: Sat Nov 29, 2008 3:25 pm
- Location: Fort Worth Texas USA
- Contact:
Re: I need a little help
put all of your js codes in echo ' your js codes here';
Instead of mixing your php, js together, have you thought about another approach like:
<html>
<script load your external js file here>
<?php
?>
</html>
Instead of mixing your php, js together, have you thought about another approach like:
<html>
<script load your external js file here>
<?php
?>
</html>
- PlagueInfected
- Forum Newbie
- Posts: 9
- Joined: Sat Nov 29, 2008 3:25 pm
- Location: Fort Worth Texas USA
- Contact:
Re: I need a little help
ya I originally did it as the external script ref tag link, but wanted to try something new with the script. I learned it fast with CSS into PHP code but with javascript. i have had no luck
i also wanted to try and hide the js too within the php script, if i called an echo the javascript would be read off the server as is wouldn't it?
i also wanted to try and hide the js too within the php script, if i called an echo the javascript would be read off the server as is wouldn't it?