JavaScript - Question About Right Click Protect Script
Hey everybody. I have this code that disables right clicking on a page. It works fine, but I'd like to tweak it a little bit if possible. When trying to right click on a page, the script will pop up an alert message. If you try right clicking a second time, you receive an option to disable the alert message. I want to disable this option so that the alert pops up every single time, but I have no idea how to actually do this. Can anybody help me out? Thanks.
Code: <script type="text/javascript" language="javascript"> var message="ALERT MESSAGE"; function click(e) { if (document.all) { if (event.button==1||event.button==2) { alert(message); return false; } } else { if (e.button==1||e.button==2) { e.preventDefault(); e.stopPropagation(); alert(message); return false; } } } if (document.all){ document.onmousedown=click; } else{ document.onclick=click; } </script> Similar TutorialsHi all, I am using the following script posted on this site: http://www.javascriptkit.com/script/...oundlink.shtml It works great, but I want to extend this script and mute the sound using a checkbox. This checkbox has the id: sound. If checked, I want to hear the sounds, when unchecked, no sounds should be heard. This is the code I currently have for the checkbox: Code: function playSound() { if (document.getElementById('sound').checked){ -something needs to be added here to make it work?- } } Anyone have an idea how to make this work? Many thanks the script below works but it reveals all the codes rather than just the one clicked, there are multiple vouchers on the page, in the php file there is one instance of <?=voucher_code?> so how is it possible to make each instance of voucher_code unique? in order fro this script to work? is it even possible or maybe there's another way? Code: <script> $(".revealVoucher").click(function () { $(".voucherCode").show("slow"); }); </script> <div class="revealVoucher"> <a href="<?=$affiliate_url?>" target="_blank">Reveal Code</a> </div> <div class="voucherCode" style="display:none;"> <a href="<?=$affiliate_url?>"><?=$voucher_code?></a> </div> Hey all I am not that much good in JS and J* kind of thigs .. help me out on this .. I am opening a Dhtmml poopup ,and it's having two buttons say YES and NO if user click on YES (mysql table) field say Yes should increse else if No (mysql table) field No should increse I hope understand the problem bascically on onclick I m using "window.open " a phpFile which is updating this all .. but I dont want to do this with window.open any help would be appreciated Thanks ayiamas What is best for creating a PTC script
Hi, Im new to javascript so thankyou in advance for reading this! Im trying to create a video gallery, with thumbnails below a main content div, which when clicked display the relevant video in the said div. This isn't a problem and I have managed to do this... However, I also need to display descriptive text (different for every video) in a seperate div, and the first video also needs to autoplay when the page is loaded (rather than waiting until the user requests a video by clicking a thumbnail) I've made an example of where Im at so far and its viewable here... http://www.phixfilm.com/video_thumbn...ideo_test.html The div 'a few lines of info about vid here' is currently just static but this is what i need to change each time a different video is requested by the user (sorry if thats obvious but just in case its not clear) I will be using .movs but I've embedded youtube for now although I don't think that makes any difference... Im presuming it will be a case of having text that is hidden until the thumbnail is clicked...? Which I guess I could do with css but that way seems a little clumsy, I really am a newbie to javascript so a helping hand in the right direction would be very much appreciated. THANKYOU! ps- an example of something similar to what Im trying to achieve is here... http://somesuchandco.com/#670098/Nathalie-Canguilhem Hey there. I'm creating my web-site now. I'm planing to have some slide/object change by itself. I know Java Script perform this task. I have get the code and apply to the image I want. It works. My idea is each of my image upper left corner have the representative number of the slide. When the slide1 go to slide 2 automatically, the number will change colour from 1 to 2. When the user click the number, the slide will change according to the number. Let said I have 3 slide. Each slide and have no 1 ,2 ,3 move forward, move backward icon on the upper left corner. I have slide1 ,slide2, slide3 change by itself within 2.5 second. When the user go thru slide 1, slide 2 and till slide3, user find out he/she interested on slide 1 and by clicking 1 on the upper left corner, the slide will change back to slide 1. Something like showing on the home page at www.easyjet.com.EN or http://www.thomascook.com/ . Both home page show a slide. This is what exactly I want. I learn HTML code before but not Java Script. I have borrow many Java Script reference book. but no idea how to inside the number on the upper left corner on each slide and how the number work accordingly with the slide. So sorry if you can't understand what I was talking about. But, anyone who understand me or have any idea how can I mortify the Java script to what I want. Just answer or email me to trista_soo@yahoo.com or facebook me on sym107@hotmail.com. Thanks for your time and efforts. Your help I really appreciate. Cheers! I work for a certain print and online publication. The one problem we have is other sites copying ad pasting our content to thier own websites or blogs. Wondering if theirs some way to allow a user to only to be able to copy/paste a certain character limit and then somehow add link to copied and pasted blurb? Maybe theirs a way to use javascript to command notepad to only allow a set number of characters.... Maybe theirs a service available or should be. Hello again . If these questions concerning Regular Expressions are inappropriate in this forum please let me know . Thank You. This expression <script[^>]*>.*?</script> matches ... Code: <script type="text/javascript">var cnnIsHomePage = true;</script> but not ... Code: <script type="text/javascript"> var cnnIsHomePage = true; </script> Please , how can i match the latter ? hello, I have designed a web site. but I want to protect my external javascript(and css also) from outside people, who steal my javascript. can anyone tell me a method to hide external javascript(and css) from these knaves...!!! thank you I know it is impossible to protect js. Minify and obfuscation don't seem very effective. But I ran across code like this, which could not be unobfuscated via simple methods. It appears to have non ascii characters (which I didn't know was possible). I would like to know how to create this same effect to help improve my protection. I realize it will not be highly secure, but something should be better than nothing. A portion of the .js: `XEnE)J:2\x00dzA\ EDIT: That doesn't work since the forum can only interpret ascii. But in the actual .js there are non ascii characters. What was done to achieve this? Hi, I'm doing some freelance for a guy and I need to make a script. I wrote a script that starts an action as soon as a file enters PS. The script needs to initiate an action as soon as 5 files enter photoshop. The files enter one by one and when the fifth one enters I want the script to start an action. I already have the action written. The coding for the script needs to be in javascript. If someone could help me write this script it would be very appreciated. Thanks, James Hi all, I have finished a program for an assigment the varibles num1,num2,num3,num4 are the final result of the calulation that i needed to preform. I can document.write these no problem. I just read the assigment and I have to create an unordered list with bullets from the results The only way i could think of doing it was to create variables so I can enter them in the list,can I do that? [var num1 =("You were born on a " + weekday[usersInputDate.getDay()]+'.','<br />'); var num2 =("You are "+(ageofUser.toFixed(2))+ " years old.<br />"); var num3 =("You are "+(usersAgeinDays.toFixed(0))+" days old.<br />"); var num4=("You have lived "+(usersExLife.toFixed(0))+" % of an average lifespan.<br />"); <ul> <li> ('num1') </li> <li> ('num2') </li> <li> ('num3') </li> <li> ('num4') </li> </ul>] How do i write this to the screen as [<li> num1 </li>] doesnt work neither does [<li> 'num1'</li>]. Does the <ul> function only read the string entered or can it run the variable assigment ? Thanks all Shayne Darcy. Help... I have a quick Java Script question... At the following page, I am asking people to copy and paste a Sponsor ID into our registration form that sits in an 'iframe'. Code: http://www.agelessoverview.com/beta/order-now.html People are screwing this up and even changing the number... So here is my question... is there a small snippet of java script I can use in the source page or iframe that will automatically fill in the Sponsoring Distributor ID:, while at the same time, blocking the input from being changed and also block the 'I don't have a sponsor' radio button? That's it! Thank you, you magicians of code. Respectfully, StealthMarketer Can someone please suggest a good (and simple) code for password protecting one page on a site? I have a plan room for blueprints on my site. There will be multiple jobs at a given time and I need a page where we can give out a password to get the plans. Once the person logs in with user name and password for that day, he would then see file folders with the name of each job next to it. When he chooses a job, he clicks the folder to display a list of plans. If you can help with this or point me in a good direction, it would be greatly appreciated. Thanks for your help! hey guys " I have question about writing a java script code equivalent to the following figure : I've written the code like this , <html> <body> <script type="text/javascript"> var x; x = 12; while (x != 0) { document.write(" x = " + x +"<BR>"); x = x - 3; } document.write("DONE"); </script> </body> </html> is my answer right or wrong ?? < I have two pages one html page and one Javascript page index.html and script.js. I want to call the javascript page 3 times to display 3 images. How would I do this from my html page. script.js Code: <script language="JavaScript"> <!-- /* Random Image Link Script By Website Abstraction (http://www.wsabstract.com) and Java-scripts.net (http://www.java-scripts.net) */ function random_imglink(){ var myimages=new Array() //specify random images below. You can have as many as you wish myimages[1]="http://flashmajic.com/Google/atomica/atomicasmallicon.jpg" myimages[2]="http://flashmajic.com/Google/atomica/atomicasmallicon.jpg" myimages[3]="http://flashmajic.com/Google/atomica/atomicasmallicon.jpg" //specify corresponding links below var imagelinks=new Array() imagelinks[1]="http://www.wsabstract.com" imagelinks[2]="http://www.dynamicdrive.com" imagelinks[3]="http://www.java-scripts.net" var ry=Math.floor(Math.random()*myimages.length) if (ry==0) ry=1 document.write('<a href='+'"'+imagelinks[ry]+'"'+'><img src="'+myimages[ry]+'" border=2 hspace=1></a>') } random_imglink() //--> </script> index.html Code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> </head> <body> ????? How would I call that script 3 times to display 3 random images? </body> </html> This is pretty much my first really useful script that I wrote myself. I am trying to load a different index.html page for each different screen size that the browser has. So the page looks best at different resolutions. I am not really able to test it since I haven't finished building all the different resolution index pages yet. I am just wondering if anyone sees any glaring errors in my coding. This is my script: Code: <script src="javascript/stndlibrary.js"> var screendim=getWindowSize(); var screenwidth=screendim[0]; var screenlength=screendim[1]; var screenw=new array(640,800,1024,1280,1400,1600,2048); //Array for standard screen widths var screenh=new array(480,600,768,1024,1050,1200,1536); //Array for standard screen heights var indexfilename=new array('vga','svga','xga','sxga','sxgap','uxga','qxga'); //Array for filenames for different pages for each screen size for (i=0;i<=6;i++); } if (screenwidth <= screenw[i]) && (screenlength <= screenh[i]); { window.location.replace('http:\\perezcomputer.com\'+indexfilename[i] + 'index.html'); break; } } </script> The stndlibrary.js file contains the function I wrote to fetch the screen width and height that will be passed back to the script. that function is he Code: function getWindowSize() { if (window.innerWidth) theWidth=window.innerWidth; else if (document.documentElement && document.documentElement.clientWidth) theWidth=document.documentElement.clientWidth; else if (document.body) theWidth=document.body.clientWidth; if (window.innerHeight) theHeight=window.innerHeight; else if (document.documentElement && document.documentElement.clientHeight) theHeight=document.documentElement.clientHeight; else if (document.body) theHeight=document.body.clientHeight; return [theWidth, theHeight] } Please be gentle I am a nOObi... Hello, I am trying to create simple Java Script form that will open a URL based on the contents entered into the form. The form shall consist of only a text box and submit button. A user will enter XXXX in the text box and click submit. The form would then load a URL consisting of http://www.company.com/XXXX I know this can be done because I had a code like this a few years back but I have lost it. I've been searching for over an hour, trying to figure this out. Any help would be grately appreciated. Thanks! Ok know those people who are in the bad habit of double clicking everything? Well my site breaks if they double click it... is there a script I can use that won't let my functions run more then once every so many seconds? to avoid double clicking errors? |