Hello guys, Welcome to my private JavaScript Tutorial. How to create Welcome Message 1. Copy the coding into the HEAD of your HTML document 2. Add the onLoad event handler into the BODY tag --> <!-- STEP ONE: Paste this code into the HEAD of your HTML document --> <HEAD> <SCRIPT LANGUAGE="JavaScript"> <!-- Begin message = "crazy-coderz.net "; colours = new Array('fff000','00ff00')//Pick your colors, any amount. siZe = 20;//Explorer only! can be outrageous size. message = message.split(' '); timer = null; clrPos = 0; msgPos = 0; jog = 1; currentStep = 10; step = 8; ns = (document.layers)?1:0; viz = (document.layers)?'hide':'hidden'; if (ns) document.write("<div id='T' style='position:absolute'></div><br>"); else { document.write("<div style='position:absolute'>"); document.write("<div align='center' style='position:relative'>"); document.write("<div id='T' style='position:absolute;width:0;height:0;font-family:Arial;font-size:0'>kurt</div>"); document.write("</div></div><br>"); } function Message() { var pageHeight = (document.layers)?window.innerHeight:window.document.body.offsetHeight; var pageWidth = (document.layers)?window.innerWidth:window.document.body.offsetWidth; if (ns) { ypos = pageHeight / 2; var Write = '<div align="center" style="width:0px;height:0px;font-family:Arial,Verdana;font-size:'+currentStep/4+'px;color:'+colours[clrPos]+'">'+message[msgPos]+'</div>'; document.T.top = ypos + -currentStep / 8 + window.pageYOffset; document.T.document.write(Write) document.T.document.close(); } else { ypos = pageHeight / 2; xpos = pageWidth / 2; T.style.width = currentStep; T.style.pixelTop = ypos + -currentStep / 16 + document.body.scrollTop; T.style.pixelLeft = (xpos - 20)+ -currentStep / 2; T.style.fontSize = currentStep / 8; T.innerHTML = message[msgPos]; T.style.color = colours[clrPos]; } if (ns)step += 5; else step += 15; currentStep += step if (ns) { if (currentStep > pageWidth) { currentStep = 10; step = 8; msgPos += jog; clrPos += jog; } if (clrPos >= colours.length) clrPos = 0; } else { if (currentStep > pageWidth * siZe) { currentStep = 10; step = 8; msgPos += jog; clrPos += jog; } if (clrPos >= colours.length) clrPos = 0; } if (msgPos >= message.length) { clearTimeout(timer); if (ns) document.T.visibility = viz; else T.style.visibility = viz; } timer = setTimeout("Message()",40) } // End --> </script> Code (markup): <!-- STEP TWO: Insert the onLoad event handler into your BODY tag --> <BODY onLoad="Message()"> Code (markup):
JUST ONE STEP TO INSTALL RAIN: 1. Copy the coding into the BODY of your HTML document pste this code into the BODY of your HTML document : <SCRIPT LANGUAGE="JavaScript"> <!-- Begin var no = 50; var speed = 1; var ns4up = (document.layers) ? 1 : 0; var ie4up = (document.all) ? 1 : 0; var s, x, y, sn, cs; var a, r, cx, cy; var i, doc_width = 800, doc_height = 600; if (ns4up) { doc_width = self.innerWidth; doc_height = self.innerHeight; } else if (ie4up) { doc_width = document.body.clientWidth; doc_height = document.body.clientHeight; } x = new Array(); y = new Array(); r = new Array(); cx = new Array(); cy = new Array(); s = 8; for (i = 0; i < no; ++ i) { initRain(); if (ns4up) { if (i == 0) { document.write("<layer name=\"dot"+ i +"\" left=\"1\" "); document.write("top=\"1\" visibility=\"show\"><font color=\"blue\">"); document.write(",</font></layer>"); } else { document.write("<layer name=\"dot"+ i +"\" left=\"1\" "); document.write("top=\"1\" visibility=\"show\"><font color=\"blue\">"); document.write(",</font></layer>"); } } else if (ie4up) { if (i == 0) { document.write("<div id=\"dot"+ i +"\" style=\"POSITION: "); document.write("absolute; Z-INDEX: "+ i +"; VISIBILITY: "); document.write("visible; TOP: 15px; LEFT: 15px;\"><font color=\"blue\">"); document.write(",</font></div>"); } else { document.write("<div id=\"dot"+ i +"\" style=\"POSITION: "); document.write("absolute; Z-INDEX: "+ i +"; VISIBILITY: "); document.write("visible; TOP: 15px; LEFT: 15px;\"><font color=\"blue\">"); document.write(",</font></div>"); } } } function initRain() { a = 6; r[i] = 1; sn = Math.sin(a); cs = Math.cos(a); cx[i] = Math.random() * doc_width + 1; cy[i] = Math.random() * doc_height + 1; x[i] = r[i] * sn + cx[i]; y[i] = cy[i]; } function makeRain() { r[i] = 1; cx[i] = Math.random() * doc_width + 1; cy[i] = 1; x[i] = r[i] * sn + cx[i]; y[i] = r[i] * cs + cy[i]; } function updateRain() { r[i] += s; x[i] = r[i] * sn + cx[i]; y[i] = r[i] * cs + cy[i]; } function raindropNS() { for (i = 0; i < no; ++ i) { updateRain(); if ((x[i] <= 1) || (x[i] >= (doc_width - 20)) || (y[i] >= (doc_height - 20))) { makeRain(); doc_width = self.innerWidth; doc_height = self.innerHeight; } document.layers["dot"+i].top = y[i]; document.layers["dot"+i].left = x[i]; } setTimeout("raindropNS()", speed); } function raindropIE() { for (i = 0; i < no; ++ i) { updateRain(); if ((x[i] <= 1) || (x[i] >= (doc_width - 20)) || (y[i] >= (doc_height - 20))) { makeRain(); doc_width = document.body.clientWidth; doc_height = document.body.clientHeight; } document.all["dot"+i].style.pixelTop = y[i]; document.all["dot"+i].style.pixelLeft = x[i]; } setTimeout("raindropIE()", speed); } if (ns4up) { raindropNS(); } else if (ie4up) { raindropIE(); } // End --> </script> Code (markup): Huhhhuhuhh...
Firstly you have to open the page with a HTML editor, notice that if you using any other page making (ASP, PHP , etc.) languages it doesn't matter. Just open it and access to source file. When you Open it, there are some codes in HTML called tags: you have to search for something called BODY In HTML code it's like <BODY> When you find it just skip a line and copy and paste after body tag the codes which we offered you in this website Anyways if you couldn't find that just paste the codes in the end of the source file. <A class=chlnk style="CURSOR: hand; font-decoration: underline" onclick="this.style.behavior='url(#default#homepag e)';this.setHomePage('http://www.xxxxxxxxxxxxx.com');" href="\">set as your home page</A><br><font face="Tahoma"> <font face="Tahoma"><a target="_blank" href="http://www.xxxxxxxxxxxxx.com/"><span style="font-size: 8pt; text-decoration: none">JavaScript Free Code</span></a></font> Code (markup):
You can bring a message box or a alert a window which tell something to user at the first when page opens Put the code below in <head> CodeHere </head> area! <script language="javascript" type="text/javascript"> alert("Welcome to my site") </script> Code (markup): Wannan see a DEMO...???? Please go to ----------> Welcome Box Demo
ou can lock the right click mouse and user or visitors can not copy and paste the info on your website its a very good code to protect of your website <script language=JavaScript> var message=""; /////////////////////////////////// function clickIE() {if (document.all) {(message);return false;}} function clickNS(e) {if (document.layers||(document.getElementById&&!docum ent.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.oncontext menu=clickIE;} </script> PHP:
You can put a box in your website, then the users can search your website with the keywords that they want, it's easy to use and very fast Users can search the keywords on the page and find the information which they entered in text box and it will search it such as search engine <SCRIPT language=JavaScript> var NS4 = (document.layers); var IE4 = (document.all); var win = window; var n = 0; function findInPage(str) { var txt, i, found; if (str == "") return false; if (NS4) { if (!win.find(str)) while(win.find(str, false, true)) n++; else n++; if (n == 0) alert("Not found."); } if (IE4) { txt = win.document.body.createTextRange(); for (i = 0; i <= n && (found = txt.findText(str)) != false; i++) { txt.moveStart("character", 1); txt.moveEnd("textedit"); } if (found) { txt.moveStart("character", -1); txt.findText(str); txt.select(); txt.scrollIntoView(); n++; } else { if (n > 0) { n = 0; findInPage(str); } else alert("Sorry, we couldn't find.Try again"); } } return false; } </SCRIPT> <FORM name=search onsubmit="return findInPage(this.string.value);"> <P align=center><FONT size=3> <INPUT style="BORDER-RIGHT: #666666 1px solid; BORDER-TOP: #666666 1px solid; FONT-SIZE: 8pt; BORDER-LEFT: #666666 1px solid; BORDER-BOTTOM: #666666 1px solid" onchange="n = 0;" size=16 name=string></FONT><BR><INPUT style="BORDER-RIGHT: #ffffff 1px solid; BORDER-TOP: #ffffff 1px solid; FONT-SIZE: 8pt; BORDER-LEFT: #ffffff 1px solid; BORDER-BOTTOM: #ffffff 1px solid; FONT-FAMILY: Tahoma; BACKGROUND-COLOR: #aaaaaa" type=submit value=Search in page ><center><font size=2pt;><font family=Times New Roman;><b> PHP:
You can fireworks on your page which can make your page fancy some dots on the user's screen colorful <body bgcolor='#000000' > <!-- Start of Fireworks --> <script language="JavaScript"> <!-- IE4+, NS4+, NS6 Fireworks script by kurt.grigg@virgin.net CL=new Array('#ff0000','#00ff00','#ffffff','#ff00ff','#ff a500','#ffff00','#00ff00','#ffffff','#ff00ff') CL2=new Array('#ffa500','#00ff00','#FFAAFF','#fff000','#ff fffF') Xpos=130; Ypos=130; I='#00ff00'; C=0; S=5; H=null; W=null; Y=null; NS4=(document.layers); NS6=(document.getElementById&&!document.all); IE4=(document.all); A=14; E=120; L=null; if (NS4){ for (i=0; i < A; i++) document.write('<LAYER NAME="nsstars'+i+'" TOP=0 LEFT=0 BGCOLOR='+I+' CLIP="0,0,2,2"></LAYER>'); } if (NS6){ window.document.body.style.overflow='hidden'; for (i=0; i < A; i++) document.write('<div id="ns6stars'+i+'" style="position:absolute;top:0px;left:0px;height:2 px;width:2px;font-size:2px;background:'+I+'"></div>'); } if (IE4){ document.write('<div id="ie" style="position:absolute;top:0px;left:0px"><div style="position:relative">'); for (i=0; i < A; i++) document.write('<div id="iestars" style="position:absolute;top:0;left:0;width:2px;he ight:2px;background:'+I+';font-size:2px"></div>'); document.write('</div></div>'); } function Fireworks(){ H=(NS4||NS6)?window.innerHeight:window.document.bo dy.clientHeight; W=(NS4||NS6)?window.innerWidth:window.document.bod y.clientWidth; Y=(NS4||NS6)?window.pageYOffset:window.document.bo dy.scrollTop; for (i=0; i < A; i++){ if (IE4)L=iestars.style; if (NS4)L=document.layers["nsstars"+i]; if (NS6)L=document.getElementById("ns6stars"+i).style ; var F = CL[Math.floor(Math.random()*CL.length)]; var RS=Math.round(Math.random()*2); L.top = Ypos + E*Math.sin((C+i*5)/3)*Math.sin(C/100) L.left= Xpos + E*Math.cos((C+i*5)/3)*Math.sin(C/100) if (C < 110){ if (NS4){L.bgColor=I;L.clip.width=1;L.clip.height=1} if (IE4||document.getElementById) {L.background=I;L.width=1;L.height=1;L.fontSize=1} } else{ if (NS4){L.bgColor=F;L.clip.width=RS;L.clip.height=RS } if (IE4||document.getElementById){L.background=F;L.wi dth=RS;L.height=RS;L.fontSize=RS} } } if (C > 220){ C=0; var NC = CL2[Math.floor(Math.random()*CL2.length)]; I=NC; E=Math.round(100+Math.random()*90); Ypos = E+Math.round(Math.random()*(H-(E*2.2)))+Y; Xpos = E+Math.round(Math.random()*(W-(E*2.2))); } C+=S; setTimeout("Fireworks()",10); } Fireworks(); // --> </script> <!-- End of Fireworks --> PHP:
It shows the time in a text box <SCRIPT LANGUAGE="JavaScript"> var timerID = null; var timerRunning = false; function stopclock () { if(timerRunning) clearTimeout(timerID); timerRunning = false; } function showtime () { var now = new Date(); var hours = now.getHours(); var minutes = now.getMinutes(); var seconds = now.getSeconds() var timeValue = "" + ((hours >12) ? hours -12 :hours) timeValue += ((minutes < 10) ? ":0" : ":") + minutes timeValue += ((seconds < 10) ? ":0" : ":") + seconds timeValue += (hours >= 12) ? " P.M." : " A.M." document.clock.face.value = timeValue; // you could replace the above with this // and have a clock on the status bar: // window.status = timeValue; timerID = setTimeout("showtime()",1000); timerRunning = true; } function startclock () { // Make sure the clock is stopped stopclock(); showtime(); } </SCRIPT> <BODY onLoad="startclock(); timerONE=window.setTimeout" TEXT="ffffff"> <CENTER><form name="clock" onSubmit="0"> <input type="text" name="face" size=13 value=""></CENTER> PHP:
Don't want people to copy your stuff and post it elsewhere? Simply use this: Paste this in between the <head> </head> Of your html and it's good! Works with FF and IE <script type="text/javascript"> //form tags to omit in NS6+: var omitformtags=["input", "textarea", "select"] omitformtags=omitformtags.join("|") function disableselect(e){ if (omitformtags.indexOf(e.target.tagName.toLowerCase())==-1) return false } function reEnable(){ return true } if (typeof document.onselectstart!="undefined") document.onselectstart=new Function ("return false") else{ document.onmousedown=disableselect document.onmouseup=reEnable } </script> PHP: