embed javascript in php

Reply

Join Date: Feb 2007
Posts: 1
Reputation: mstemmer is an unknown quantity at this point 
Solved Threads: 0
mstemmer mstemmer is offline Offline
Newbie Poster

embed javascript in php

 
0
  #1
Feb 17th, 2007
Hello all,
I'd like to embed a javascript code into this part of the php/html
  1. ?>
  2. <a href="<?=$images[$k][0]?>" target="blank">
  3. <img src="<?=$thumbdir."/".$images[$k][0]?>" border="0"><br />
  4. <?=$images[$k][0]?>
  5. </a><br />
  6. <?=round($images[$k][2]/1024)?>Kb, <?=date("d-m-y",$images[$k][1])?>
  7.  
  8. <?

I'd like to add this javascript to it:
  1. <script language=JavaScript>
  2. <!--
  3. //Disable right mouse click Script
  4. //By Maximus (<a href="mailto:maximus@nsimail.com">maximus@nsimail.com</a>) w/ mods by DynamicDrive
  5. //For full source code, visit <a rel="nofollow" class="t" href="http://www.dynamicdrive.com" target="_blank">http://www.dynamicdrive.com</a>
  6. var message="Function Disabled!";
  7. ///////////////////////////////////
  8. function clickIE4(){
  9. if (event.button==2){
  10. alert(message);
  11. return false;
  12. }
  13. }
  14. function clickNS4(e){
  15. if (document.layers||document.getElementById&&!document.all){
  16. if (e.which==2||e.which==3){
  17. alert(message);
  18. return false;
  19. }
  20. }
  21. }
  22. if (document.layers){
  23. document.captureEvents(Event.MOUSEDOWN);
  24. document.onmousedown=clickNS4;
  25. }
  26. else if (document.all&&!document.getElementById){
  27. document.onmousedown=clickIE4;
  28. }
  29. document.oncontextmenu=new Function("alert(message);return false")
  30. // -->
  31. </script>

My problem is that when I add this myself, a blank page will open but I'm still able to rightclick my mouse.
Can anyone give me an example how to correct this?

Thanks.
Last edited by stymiee; Feb 18th, 2007 at 11:17 am. Reason: added code tags
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC