PDA

View Full Version : Code errors on page, help me troubleshoot please!


Grimdeath9740
Dec-30-2005, 08:18 AM
Im a cut and paste kinda guy so ive run into a couple errors on my pages. everythings working ok but if anyone can help me revise the sections of codes that are "bad" it would be much appreciated. Heres the site:

http://www.gordon-photography.smugmug.com

*edit*
btw these are only in IE, firefox is working great.

Andy
Dec-30-2005, 08:22 AM
Is there a reason why you have javascript in your HEAD section of customization?


<td><script language=JavaScript>
<!--

//Disable right click script III- By Renigade (renigade@mediaone.net)
//For full source code, visit http://www.dynamicdrive.com

var message="";
///////////////////////////////////
function clickIE() {if (document.all) {(message);return false;}}
function clickNS(e) {if
(document.layers||(document.getElementById&&!document.all)) {
if (e.which==2||e.which==3) {(message);return false;}}}
if (document.layers)
{document.captureEvents(Event.MOUSEDOWN);document.onmousedown=clickNS;}
else{document.onmouseup=clickNS;document.oncontextmenu=clickIE;}

document.oncontextmenu=new Function("return false")

document.oncontextmenu=function(){return false;}
// -->
</script></td>

<META HTTP-EQUIV="imagetoolbar" CONTENT="no">

Andy
Dec-30-2005, 08:25 AM
Im a cut and paste kinda guy so ive run into a couple errors on my pages. everythings working ok but if anyone can help me revise the sections of codes that are "bad" it would be much appreciated. Heres the site:

http://www.gordon-photography.smugmug.com

*edit*
btw these are only in IE, firefox is working great.

I'm looking at your page in IE, what errors are you seeing? Screen grabs help a lot :thumb

Grimdeath9740
Dec-30-2005, 08:27 AM
http://www.java-scripts.net/javascripts/Right-Click-Block.phtml

the second part of that script says to go into the body section, but the body section i see under smugmug's customization page is only one line long...i experimented and well, it worked so i went with it....LMK where i SHOULD put it. thanks for the super quick responce!

Andy
Dec-30-2005, 08:59 AM
http://www.java-scripts.net/javascripts/Right-Click-Block.phtml

the second part of that script says to go into the body section, but the body section i see under smugmug's customization page is only one line long...i experimented and well, it worked so i went with it....LMK where i SHOULD put it. thanks for the super quick responce!

I can't tell you but one of the javascripters will be along, I'm sure... standby...

flyingdutchie
Dec-30-2005, 10:03 AM
http://www.java-scripts.net/javascripts/Right-Click-Block.phtml

the second part of that script says to go into the body section, but the body section i see under smugmug's customization page is only one line long...i experimented and well, it worked so i went with it....LMK where i SHOULD put it. thanks for the super quick responce!

It works as it is right now: right-clicking does not work, and this is what you want. And i see no javascript errors at all :)

You may want to put it into your 'javascript' section of your customization instead, but without the <script language=JavaScript><!-- and --></script> elements! If you do this correctly, it should work as it is now.

Grimdeath9740
Dec-30-2005, 10:17 AM
alright, ill try it out, thanks!

*edit*
meh, nah that doesnt work. the script is in two sections and one section IS in the javascript section, both together doesnt seem to work. If all else fails ill leave it as is(working)

flyingdutchie
Dec-30-2005, 10:21 AM
alright, ill try it out, thanks!
Kewl, :D
So only put this into the 'javascript' field of your customization:

//Disable right click script III- By Renigade (renigade@mediaone.net)
//For full source code, visit http://www.dynamicdrive.com
var message="";
///////////////////////////////////
function clickIE() {if (document.all) {(message);return false;}}
function clickNS(e) {if
(document.layers||(document.getElementById&&!document.all)) {
if (e.which==2||e.which==3) {(message);return false;}}}
if (document.layers)
{document.captureEvents(Event.MOUSEDOWN);document.onmousedown=clickNS;}
else{document.onmouseup=clickNS;document.oncontextmenu=clickIE;}


And remove it from your 'Head tag' section.

flyingdutchie
Dec-30-2005, 10:24 AM
alright, ill try it out, thanks!

*edit*
meh, nah that doesnt work. the script is in two sections and one section IS in the javascript section, both together doesnt seem to work. If all else fails ill leave it as is(working)

If you have galleries with 'protected' images, the javascript you use may not work or the protection mechanism may fail. If you don't have protected images, don't worry and ignore this post.

flyingdutchie
Dec-30-2005, 10:26 AM
alright, ill try it out, thanks!

*edit*
meh, nah that doesnt work. the script is in two sections and one section IS in the javascript section, both together doesnt seem to work. If all else fails ill leave it as is(working)

Just try to add these two lines at the bottom of your javascript section:
document.oncontextmenu=new Function("return false")
document.oncontextmenu=function(){return false;}
If this does not work either, leave it alone and go back to your original working version.

However, be sure that you don't have <td> and </td> elements in your script! I saw these in your page's source.

EDIT: Actually, i just examined your script a bit more, you can replace all this script with just one statement and put this in your javascript section:
document.oncontextmenu=new Function("return false");
That's it :)