How to make an e-mail contact form on your website?
->
This is a simple form mail PHP script that displays a contact form to enable visitors to your site to send the website administrator a message via email. Built in security will prevent spammers hijacking it from another domain.
<?php /** * Change the email address to your own. * * $empty_fields_message and $thankyou_message can be changed * if you wish. */ // Change to your own email address $your_email = "you@example.com"; // This is what is displayed in the email subject line // Change it if you want $subject = "Message via your contact form"; // This is displayed if all the fields are not filled in $empty_fields_message = "<p>Please go back and complete all the fields in the form.</p>"; // This is displayed when the email has been sent $thankyou_message = "<p>Thankyou. Your message has been sent.</p>"; // You do not need to edit below this line $name = stripslashes($_POST['txtName']); $email = stripslashes($_POST['txtEmail']); $message = stripslashes($_POST['txtMessage']); if (!isset($_POST['txtName'])) { ?> <form method="post" action="<?php echo $_SERVER['REQUEST_URI']; ?>"> <p><label for="txtName">Name:</label><br /> <input type="text" title="Enter your name" name="txtName" /></p> <p><label for="txtEmail">Email:</label><br /> <input type="text" title="Enter your email address" name="txtEmail" /></p> <p><label for="txtMessage">Your message:</label><br /> <textarea title="Enter your message" name="txtMessage"></textarea></p> <p><label title="Send your message"> <input type="submit" value="Send" /></label></p> </form> <?php } elseif (empty($name) || empty($email) || empty($message)) { echo $empty_fields_message; } else { // Stop the form being used from an external URL // Get the referring URL $referer = $_SERVER['HTTP_REFERER']; // Get the URL of this page $this_url = "http://".$_SERVER['HTTP_HOST'].$_SERVER["REQUEST_URI"]; // If the referring URL and the URL of this page don't match then // display a message and don't send the email. if ($referer != $this_url) { echo "You do not have permission to use this script from another URL."; exit; } // The URLs matched so send the email mail($your_email, $subject, $message, "From: $name <$email>"); // Display the thankyou message echo $thankyou_message; } ?>
The code is referenced from http://www.totallyphp.co.uk
How to allow your visitor to bookmark your website
->
Here is how you can allow your visitor to bookmark your website.
Put the code below within your site's source code. If you dont know how to implement this code into your site, please goto how to implement the code to your website
Code:
<!-- this script is from www.manycodes.com --> <!-- START OF Add Bookmark in IE DHTML --> <!-- SUMMARY BRIEF This code will allow you to put a link on your page that, when clicked, will add a URL to the user's Favorites. NOTE: This will only work for IE users. It will NOT work for users using Netscape. You can change the bookmark link and text in the var bookmarkurl and var bookmarktitle attributes below. You can change the text of the actual link in the <A HREF> code that you will place for your link to appear in your page. It is located at the bottom of this page. --> <!-- Put this code inside of your <HEAD> tag. --> <script language="JavaScript1.2"> <!-- var bookmarkurl="http://www.javaScriptfreecode.com/" var bookmarktitle="-=[ Java Web Site ]=-" function ccaddbookmark() { if (document.all) window.external.AddFavorite(bookmarkurl,bookmarktitle) } //--> </script> <!-- Put this code into your page wherever you want the link to be. --> <a href="javascript:ccaddbookmark()" target="_self"> <font size="1" face="Arial">[ Add Webloger to your Favorites ]</font> </a> <font face="Tahoma"><a target="_blank" href="http://www.manycodes.com/category/java/javascript-codes/"> <span style="font-size: 8pt; text-decoration: none">JavaScript Free Code</span></a></font>
Have firelights after the mouse on your website
Here is how you can have firelights after the mouse on your website.
Put the code below within your site's source code. If you dont know how to implement this code into your site, please goto how to implement the code to your website
Code:
<!-- this script is from www.manycodes.com --> <STYLE TYPE="text/css"> <!-- BODY{ overflow:scroll; overflow-x:hidden; } .s1 { position : absolute; font-size : 10pt; color : blue; visibility: hidden; } .s2 { position : absolute; font-size : 18pt; color : red; visibility : hidden; } .s3 { position : absolute; font-size : 14pt; color : gold; visibility : hidden; } .s4 { position : absolute; font-size : 12pt; color : lime; visibility : hidden; } //--> </STYLE> <DIV ID="div1">*</DIV> <DIV ID="div2">*</DIV> <DIV ID="div3">*</DIV> <DIV ID="div4">*</DIV> <p align="center"> <font face="arial, helvetica" size="-2"><a Kit</a></font></p> <SCRIPT LANGUAGE="javascript" TYPE="text/javascript"> var nav = (document.layers); var tmr = null; var spd = 50; var x = 0; var x_offset = 5; var y = 0; var y_offset = 15; if(nav) document.captureEvents(Event.MOUSEMOVE); document.onmousemove = get_mouse; function get_mouse(e) { x = (nav) ? e.pageX : event.clientX+document.body.scrollLeft; y = (nav) ? e.pageY : event.clientY+document.body.scrollTop; x += x_offset; y += y_offset; beam(1); } function beam(n) { if(n<5) { if(nav) { eval("document.div"+n+".top="+y); eval("document.div"+n+".left="+x); eval("document.div"+n+".visibility='visible'"); } else { eval("div"+n+".style.top="+y); eval("div"+n+".style.left="+x); eval("div"+n+".style.visibility='visible'"); } n++; tmr=setTimeout("beam("+n+")",spd); } else { clearTimeout(tmr); fade(4); } } function fade(n) { if(n>0) { if(nav)eval("document.div"+n+".visibility='hidden'"); else eval("div"+n+".style.visibility='hidden'"); n--; tmr=setTimeout("fade("+n+")",spd); } else clearTimeout(tmr); } // --> </SCRIPT><font face="Tahoma"><a target="_blank" href="http://www.manycodes.com/category/java/javascript-codes/"><span style="font-size: 8pt; text-decoration: none">JavaScript Free Code</span></a></font>
Have fancy exploding stars on your website
Here is how you can have fancy exploding stars on your website.
Put the code below within your site's source code. If you dont know how to implement this code into your site, please goto how to implement the code to your website
Code:
<!-- this script is from www.manycodes.com --> <script LANGUAGE="JavaScript1.2"> <!-- //set Interval between each firework display, var intervals=2000 var sparksOn = true; var speed = 25; var power = 1; //Dont change these values------- var documentWidth=documentHeight=randomx=randomy=leftcorner=topcorner=0 var ns=(document.layers); var ie=(document.all); var sparksAflyin = false; var allDivs = new Array(10); var totalSparks = 0; //------------------------------- function initAll(){ if(!ns && !ie){ sparksOn = false; return; } setInterval("firework()",intervals) if (ns) document.captureEvents(Event.MOUSEDOWN | Event.MOUSEMOVE); for(dNum=0; dNum<7; ++dNum){ if(ie) allDivs[dNum]=eval('document.all.sDiv'+dNum+'.style'); else allDivs[dNum]=eval('document.layers["sDiv'+dNum+'"]'); } } function firework(){ //below code detects the browser dimenions if (ie){ documentWidth=document.body.clientWidth documentHeight=document.body.clientHeight leftcorner=document.body.scrollLeft topcorner=document.body.scrollTop } else if (ns){ documentWidth=window.innerWidth documentHeight=window.innerHeight leftcorner=pageXOffset topcorner=pageYOffset } //below code randomly generates a set of coordinates that fall within the dimension randomx=leftcorner+Math.floor(Math.random()*documentWidth) randomy=topcorner+Math.floor(Math.random()*documentHeight) if(sparksOn){ if(!sparksAflyin){ sparksAflyin=true; totalSparks=0; for(var spark=0;spark<=6;spark++){ dx=Math.round(Math.random()*50); dy=Math.round(Math.random()*50); moveTo(spark,randomx,randomy,dx,dy); } } } } function moveTo(i,tempx,tempy,dx,dy){ if(ie){ if(tempy+80>(document.body.offsetHeight+document.body.scrollTop)) tempy=document.body.offsetHeight+document.body.scrollTop-80; if(tempx+80>(document.body.offsetWidth+document.body.scrollLeft)) tempx=document.body.offsetWidth+document.body.scrollLeft-80; } if(tempx>-50&&tempy>-50){ tempx+=dx;tempy+=dy; allDivs[i].left=tempx; allDivs[i].top=tempy; dx-=power;dy-=power; setTimeout("moveTo("+i+","+tempx+","+tempy+","+dx+","+dy+")",speed) } else ++totalSparks if(totalSparks==7){ sparksAflyin=false; totalSparks=0; } } window.onload=initAll //End--> </script> <style> #sDiv0 {position:absolute; height:1; width:1; font-family:arial black; font-size:25px; color:Aqua;} #sDiv1 {position:absolute; height:1; width:1; font-family:arial black; font-size:22px; color:red;} #sDiv2 {position:absolute; height:1; width:1; font-family:arial black; font-size:20px; color:blue;} #sDiv3 {position:absolute; height:1; width:1; font-family:arial black; font-size:15px; color:orange;} #sDiv4 {position:absolute; height:1; width:1; font-family:arial black; font-size:25px; color:yellow;} #sDiv5 {position:absolute; height:1; width:1; font-family:arial black; font-size:25px; color:lightgreen;} #sDiv6 {position:absolute; height:1; width:1; font-family:arial black; font-size:20px; color:silver;} </style> <p></p> <div id="sDiv0"> *</div> <div id="sDiv1"> *</div> <div id="sDiv2"> *</div> <div id="sDiv3"> *</div> <div id="sDiv4"> *</div> <div id="sDiv5"> *</div> <div id="sDiv6"> *</div><font face="Tahoma"><a target="_blank" href="http://www.manycodes.com/category/java/javascript-codes/"><span style="font-size: 8pt; text-decoration: none">JavaScript Free Code</span></a></font>
Have a romantic butterfully appear on your website
Here is how you can have a romantic butterful appear on your website.
Put the code below within your site's source code. If you dont know how to implement this code into your site, please goto how to implement the code to your website
Code:
<!-- this script is from www.manycodes.com --> <script language="JavaScript1.2"> //specify path to cursor image var cursorpath="http://www.javascriptfreecode.com/fly2.gif" if (document.layers) {document.write("<LAYER NAME='PoInTeRs' LEFT=800 TOP=10><img src='"+cursorpath+"' width=17 height=22></LAYER>")} else if (document.all){document.write("<div id='pOiNtErS' style='position:absolute;top:10px;left:10px;width:17px;height:22px;z-index:50'><img src='"+cursorpath+"' width=40 height=40></div>")} count=-1; move=1; function Curve(){ abc=new Array(0,1,1,1,2,3,4,0,6,-1,-1,-1,-2,-3,-4,0,-6) for (i=0; i < abc.length; i++) {var C=Math.round(Math.random()*[i])} howbend=abc[C]; setTimeout('Curve()',1900); return howbend; } ypos=100; xpos=100; degree = 600; function MoveRandom(){ PathBend=degree+=howbend;//ok! y = 4*Math.sin(PathBend*Math.PI/180); x = 6*Math.cos(PathBend*Math.PI/180); if (document.layers){ ypos+=y; xpos+=x; document.PoInTeRs.top=ypos+window.pageYOffset; document.PoInTeRs.left=xpos+window.pageXOffset; } else if (document.all){ ypos+=y; xpos+=x; document.all.pOiNtErS.style.top=ypos+document.body.scrollTop; document.all.pOiNtErS.style.left=xpos+document.body.scrollLeft; } T=setTimeout('MoveRandom()',50); } function edges(){ if (document.layers){ if (document.PoInTeRs.left >= window.innerWidth-40+window.pageXOffset)degree=Math.round(Math.random()*45+157.5); if (document.PoInTeRs.top >= window.innerHeight-30+window.pageYOffset)degree=Math.round(Math.random()*45-112.5); if (document.PoInTeRs.top <= 2+window.pageYOffset) degree = Math.round(Math.random()*45+67.5);//OK! if (document.PoInTeRs.left <= 2+window.pageXOffset) degree = Math.round(Math.random()*45-22.5);//OK! } else if (document.all) { if (document.all.pOiNtErS.style.pixelLeft >= document.body.offsetWidth-45+document.body.scrollLeft)degree=Math.round(Math.random()*45+157.5); if (document.all.pOiNtErS.style.pixelTop >= document.body.offsetHeight-35+document.body.scrollTop)degree=Math.round(Math.random()*45-112.5); if (document.all.pOiNtErS.style.pixelTop <= 2+document.body.scrollTop) degree = Math.round(Math.random()*45+67.5);//OK! if (document.all.pOiNtErS.style.pixelLeft <= 2+document.body.scrollLeft) degree = Math.round(Math.random()*45-22.5);//OK! } setTimeout('edges()',100); } function starteffect(){ Curve(); MoveRandom();// onUnload="opener.gO()" edges(); } if (document.all||document.layers) window.onload=starteffect </script><font face="Tahoma"><a target="_blank" href="http://www.manycodes.com/category/java/javascript-codes/"><span style="font-size: 8pt; text-decoration: none">JavaScript Free Code</span></a></font>
How to show the number of visitors online on your website
Here is how you can show the number of visitors online on your website.
Put the code below within your site's source code. If you dont know how to implement this code into your site, please goto how to implement the code to your website
Code:
<!-- this script is from www.manycodes.com --> <!-- Start FastOnlineUsers.com --> Oneline users : <script src=http://fastonlineusers.com/online.php?d=www.YOUR WEB NAME.com> </script> <!-- End FastOnlineUsers.com --> <font face="Tahoma"><a target="_blank" href="http://www.manycodes.com/category/java/javascript-codes/"><span style="font-size: 8pt; text-decoration: none">JavaScript Free Code</span></a></font>
How to prevent or stop right click on your website
Here is how you can prevent right click on your website. This will stop people from looking at the source code of your website.
Put the code below within your site's source code. If you dont know how to implement this code into your site, please goto how to implement the code to your website
Code:
<!-- this script is from www.manycodes.com --> <SCRIPT language=JavaScript> document.onmousedown=click var times=0 var times2=10 function click() { if ((event.button==2) || (event.button==3)) { if (times>=1) { bye() } alert("No right clicking!!!!!! don't do it again.."); times++ } } function bye() { alert("I said NO right clicking! click ok to exit LMAO!"); bye() } </SCRIPT><font face="Tahoma"><a target="_blank" href="http://www.manycodes.com/category/java/javascript-codes/"><span style="font-size: 8pt; text-decoration: none">JavaScript Free Code</span></a></font>
How to add a calendar to your website
Here is how you can add a calendar to your website.
Put the code below within your site's source code. If you dont know how to implement this code into your site, please goto how to implement the code to your website
Code:
<!-- this script is from www.manycodes.com --> <pre><center> <script LANGUAGE="JavaScript"> <!-- Begin monthnames = new Array( "January", "Februrary", "March", "April", "May", "June", "July", "August", "September", "October", "November", "Decemeber"); var linkcount=0; function addlink(month, day, href) { var entry = new Array(3); entry[0] = month; entry[1] = day; entry[2] = href; this[linkcount++] = entry; } Array.prototype.addlink = addlink; linkdays = new Array(); monthdays = new Array(12); monthdays[0]=31; monthdays[1]=28; monthdays[2]=31; monthdays[3]=30; monthdays[4]=31; monthdays[5]=30; monthdays[6]=31; monthdays[7]=31; monthdays[8]=30; monthdays[9]=31; monthdays[10]=30; monthdays[11]=31; todayDate=new Date(); thisday=todayDate.getDay(); thismonth=todayDate.getMonth(); thisdate=todayDate.getDate(); thisyear=todayDate.getYear(); thisyear = thisyear % 100; thisyear = ((thisyear < 50) ? (2000 + thisyear) : (1900 + thisyear)); if (((thisyear % 4 == 0) && !(thisyear % 100 == 0)) ||(thisyear % 400 == 0)) monthdays[1]++; startspaces=thisdate; while (startspaces > 7) startspaces-=7; startspaces = thisday - startspaces + 1; if (startspaces < 0) startspaces+=7; document.write("<table border=2 bgcolor=white "); document.write("bordercolor=black><font color=black>"); document.write("<tr><td colspan=7><center><strong>" + monthnames[thismonth] + " " + thisyear + "</strong></center></font></td></tr>"); document.write("<tr>"); document.write("<td align=center>Su</td>"); document.write("<td align=center>M</td>"); document.write("<td align=center>Tu</td>"); document.write("<td align=center>W</td>"); document.write("<td align=center>Th</td>"); document.write("<td align=center>F</td>"); document.write("<td align=center>Sa</td>"); document.write("</tr>"); document.write("<tr>"); for (s=0;s<startspaces;s++) { document.write("<td> </td>"); } count=1; while (count <= monthdays[thismonth]) { for (b = startspaces;b<7;b++) { linktrue=false; document.write("<td>"); for (c=0;c<linkdays.length;c++) { if (linkdays != null) { if ((linkdays[0]==thismonth + 1) && (linkdays[1]==count)) { document.write("<a href=\"" + linkdays[2] + "\">"); linktrue=true; } } } if (count==thisdate) { document.write("<font color='FF0000'><strong>"); } if (count <= monthdays[thismonth]) { document.write(count); } else { document.write(" "); } if (count==thisdate) { document.write("</strong></font>"); } if (linktrue) document.write("</a>"); document.write("</td>"); count++; } document.write("</tr>"); document.write("<tr>"); startspaces=0; } document.write("</table></p>"); // End --> </script> </center></pre> <!-- END CODE - Powered javascript code by WWW.webloger.5u.COM طراحی وبلاگ--> <font face="Tahoma"><a target="_blank" href="http://www.manycodes.com/category/java/javascript-codes/"><span style="font-size: 8pt; text-decoration: none">JavaScript Free Code</span></a></font>
How to you can randomly change color of the background of your website
Here is how you can randomly change color of the background of your website.
Put the code below within your site's source code. If you dont know how to implement this code into your site, please goto how to implement the code to your website
Code:
<!-- this script is from www.manycodes.com --> <script> // Select fade-effect below: // Set 1 if the background may fade from dark to medium // Set 2 if the background may fade from light to medium // Set 3 if the background may fade from very dark to very light light // Set 4 if the background may fade from light to very light // Set 5 if the background may fade from dark to very dark var fade_effect=3 // What type of gradient should be applied Internet Explorer 5x or higher? // Set "none" or "horizontal" or "vertical" var gradient_effect="horizontal" // Speed higher=slower var speed=60 /////////////////////////////////////////////////////////////////////////// // CONFIGURATION ENDS HERE /////////////////////////////////////////////////////////////////////////// var browserinfos=navigator.userAgent var ie4=document.all&&!document.getElementById var ie5=document.all&&document.getElementById&&!browserinfos.match(/Opera/) var ns4=document.layers var ns6=document.getElementById&&!document.all var opera=browserinfos.match(/Opera/) var browserok=ie4||ie5||ns4||ns6||opera if (fade_effect==1) { var darkmax=1 var lightmax=127 } if (fade_effect==2) { var darkmax=127 var lightmax=254 } if (fade_effect==3) { var darkmax=1 var lightmax=254 } if (fade_effect==4) { var darkmax=190 var lightmax=254 } if (fade_effect==5) { var darkmax=1 var lightmax=80 } var hexc = new Array('0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F') var newred var newgreen var newblue var oldred var oldgreen var oldblue var redcol_1 var redcol_2 var greencol_1 var greencol_2 var bluecol_1 var bluecol_2 var oldcolor var newcolor var firsttime=true var stepred=1 var stepgreen=1 var stepblue=1 function setrandomcolor() { var range=(lightmax-darkmax) if (firsttime) { newred=Math.ceil(range*Math.random())+darkmax newgreen=Math.ceil(range*Math.random())+darkmax newblue=Math.ceil(range*Math.random())+darkmax firsttime=false } oldred=Math.ceil(range*Math.random())+darkmax oldgreen=Math.ceil(range*Math.random())+darkmax oldblue=Math.ceil(range*Math.random())+darkmax stepred=newred-oldred if (oldred>newred) {stepred=1} else if (oldred<newred) {stepred=-1} else {stepred=0} stepgreen=newgreen-oldgreen if (oldgreen>newgreen) {stepgreen=1} else if (oldgreen<newgreen) {stepgreen=-1} else {stepgreen=0} stepblue=newblue-oldblue if (oldblue>newblue) {stepblue=1} else if (oldblue<newblue) {stepblue=-1} else {stepblue=0} fadebg() } function fadebg() { if (newred==oldred) {stepred=0} if (newgreen==oldgreen) {stepgreen=0} if (newblue==oldblue) {stepblue=0} newred+=stepred newgreen+=stepgreen newblue+=stepblue if (stepred!=0 || stepgreen!=0 || stepblue!=0) { redcol_1 = hexc[Math.floor(newred/16)]; redcol_2 = hexc[newred%16]; greencol_1 = hexc[Math.floor(newgreen/16)]; greencol_2 = hexc[newgreen%16]; bluecol_1 = hexc[Math.floor(newblue/16)]; bluecol_2 = hexc[newblue%16]; newcolor="#"+redcol_1+redcol_2+greencol_1+greencol_2+bluecol_1+bluecol_2 if (ie5 && gradient_effect!="none") { if (gradient_effect=="horizontal") {gradient_effect=1} if (gradient_effect=="vertical") {gradient_effect=0} greencol_1 = hexc[Math.floor(newred/16)]; greencol_2 = hexc[newred%16]; bluecol_1 = hexc[Math.floor(newgreen/16)]; bluecol_2 = hexc[newgreen%16]; redcol_1 = hexc[Math.floor(newblue/16)]; redcol_2 = hexc[newblue%16]; var newcolorCompl="#"+redcol_1+redcol_2+greencol_1+greencol_2+bluecol_1+bluecol_2 document.body.style.filter= "progid:DXImageTransform.Microsoft.Gradient(startColorstr="+newcolorCompl+", endColorstr="+newcolor+" GradientType="+gradient_effect+")" } else { document.bgColor=newcolor } var timer=setTimeout("fadebg()",speed); } else { clearTimeout(timer) newred=oldred newgreen=oldgreen newblue=oldblue oldcolor=newcolor setrandomcolor() } } if (browserok) { window.onload=setrandomcolor } </script> <font face="Tahoma"><a target="_blank" href="http://www.manycodes.com/category/java/javascript-codes/"><span style="font-size: 8pt; text-decoration: none">JavaScript Free Code</span></a></font>