code
You are browsing the code tag archive.
Make this page your start page code
Want an option for visitors to make your page their start page?
Place this code where you would like the link to appear on your site and change yourdomain to your domain name. Only works with Internet Explorer browser.
<!– Start Make Homepage Code –>
<!–[if IE]>
<a HREF onClick=”this.style.behavior=’url(#default#homepage)’;this.setHomePage(’http://www.yourdomain.com’);”>Click here to make this site your start page!</a></font>
<![endif]–>
<!– End Make Homepage Code –>
Add To Your Favorites Link
Add this code to your page and when clicked it will help others to add your site to their favorites list.
Place this code into the head of your page:
<script language=”JavaScript”>
function bookmark(url, description)
{
netscape=”Netscape User’s hit CTRL+D to add a bookmark to this site.”
if (navigator.appName==’Microsoft Internet Explorer’)
{
window.external.AddFavorite(url, description);
}
else if (navigator.appName==’Netscape’)
{
alert(netscape);
}
}
//–>
</SCRIPT>
Place this in your body of your page where you want the link to appear:
<a href=”javascript:bookmark(’http://www.yourdomain.com’,'Name of your site’);”>Click here to add this site to your favorites list!</A>
Colored Scrollbars
Add this to your css style sheet or if you don’t have one you can add it to your head tags.
Change the colors to that of your own likings.
BODY
{
scrollbar-arrow-color: #FFFFFF;
scrollbar-track-color: #FFFFFF;
scrollbar-face-color: #444444;
scrollbar-highlight-color: #FFFFFF;
scrollbar-3dlight-color: #000000;
scrollbar-darkshadow-color: #000000;
scrollbar-shadow-color: #444444;
}
Graphic Hovering Effect On Links
When you mouse over links in our forums you will see a graphical hovering effect. Here is the code to get this same results on your website.
Code:
a:hover, a:active { background: url(http://www.yourdomain.com/images/yourgraphic.gif); }
You must replace yourdomain with your own website address.
You must have a graphic to use for the hovering effect and change the path to [...]
Shakey Images
This code will make an image shake when you hover over it with your mouse.
Place this into the head of your webpage:
<style>
.shakeimage{
position:relative
}
</style>
<script language=”JavaScript1.2″>
/*
Shake image script (onMouseover)-
© Dynamic Drive (www.dynamicdrive.com)
For full source code, usage terms, and 100’s more DHTML scripts, visit http://dynamicdrive.com
*/
//configure shake degree (where larger # equals greater shake)
var rector=3
///////DONE EDITTING///////////
var stopit=0
var a=1
function init(which){
stopit=0
shake=which
shake.style.left=0
shake.style.top=0
}
function rattleimage(){
if ((!document.all&&!document.getElementById)||stopit==1)
return
if (a==1){
shake.style.top=parseInt(shake.style.top)+rector
}
else if (a==2){
shake.style.left=parseInt(shake.style.left)+rector
}
else if (a==3){
shake.style.top=parseInt(shake.style.top)-rector
}
else{
shake.style.left=parseInt(shake.style.left)-rector
}
if (a<4)
a++
else
a=1
setTimeout(”rattleimage()”,50)
}
function stoprattle(which){
stopit=1
which.style.left=0
which.style.top=0
}
</script>
Place this where you want your shakable image to appear and replace the image url to that of your own:
<img src=”http://www.yourdomain.com/imagepath/imagename” class=”shakeimage” onMouseover=”init(this);rattleimage()” onMouseout=”stoprattle(this);top.focus()” onClick=”top.focus()”>
No Right Click On Images Only
Don’t want visitors to be able to right click on your images?
Paste this into the head of your webpage:
<script language=”JavaScript1.2″>
/*
Disable right click script II (on images)- By Dynamicdrive.com
For full source, Terms of service, and 100s DTHML scripts
Visit http://www.dynamicdrive.com
*/
var clickmessage=”Right click disabled on images!”
function disableclick(e) {
if (document.all) {
if (event.button==2||event.button==3) {
if (event.srcElement.tagName==”IMG”){
alert(clickmessage);
return false;
}
}
}
else if (document.layers) {
if (e.which == 3) {
alert(clickmessage);
return false;
}
}
else if (document.getElementById){
if (e.which==3&&e.target.tagName==”IMG”){
alert(clickmessage)
return false
}
}
}
function associateimages(){
for(i=0;i<document.images.length;i++)
document.images[i].onmousedown=disableclick;
}
if (document.all)
document.onmousedown=disableclick
else if (document.getElementById)
document.onmouseup=disableclick
else if (document.layers)
associateimages()
</script>
No Right Click Without A Warning
Don’t want visitors to be able to right click on your page yet you don’t like giving them a popup warning either?
Paste this code into the head of your webpage:
<script language=JavaScript>
<!–
//Disable right click script III- By Renigade ( \n
<!–
var prefix = ‘ma’ + ‘il’ + ‘to’;
var path = ‘hr’ + ‘ef’ + ‘=’;
var [...]
No Right Clicking With Warning
Don’t want people to be able to right click on your page and want to warn them so? Paste this code into the head of your page.
Place this into the head of your page:
<script language=”JavaScript”> <!–
// No rightclick script v.2.5
// (c) 1998 barts1000
// \n
<!–
var prefix = ‘ma’ + ‘il’ + ‘to’;
var path = ‘hr’ + [...]
Highlight Image
This script will turn your image to grey and then when you hover over it with your cursor it will turn back to it’s color.
Place this code into the head of your page:
<script language=”JavaScript1.2″>
//Gradual-Highlight image script- By Dynamic Drive
//For full source code and more DHTML scripts, visit http://www.dynamicdrive.com
//This credit MUST stay intact for use
function high(which2){
theobject=which2
highlighting=setInterval(”highlightit(theobject)”,50)
}
function low(which2){
clearInterval(highlighting)
if (which2.style.MozOpacity)
which2.style.MozOpacity=0.3
else if (which2.filters)
which2.filters.alpha.opacity=30
}
function highlightit(cur2){
if (cur2.style.MozOpacity<1)
cur2.style.MozOpacity=parseFloat(cur2.style.MozOpacity)+0.1
else if (cur2.filters&&cur2.filters.alpha.opacity<100)
cur2.filters.alpha.opacity+=10
else if (window.highlighting)
clearInterval(highlighting)
}
</script>
Use this code to link up your images. Just change the domain to your’s and the file name to that of your image [...]
Drag Images
This code works great for puzzles or image makers.
Place this in the head of your page:
<style>
<!–
.drag{position:relative;cursor:hand}
–>
</style>
<script language=”JavaScript1.2″>
<!–
//Generic Drag Script- © Dynamic Drive (www.dynamicdrive.com)
//For full source code and terms of usage,
//visit http://www.dynamicdrive.com
var ie=document.all
var ns6=document.getElementById&&!document.all
var dragapproved=false
var z,x,y
function move(e){
if (dragapproved){
z.style.left=ns6? temp1+e.clientX-x: temp1+event.clientX-x
z.style.top=ns6? temp2+e.clientY-y : temp2+event.clientY-y
return false
}
}
function drags(e){
if (!ie&&!ns6)
return
var firedobj=ns6? e.target : event.srcElement
var topelement=ns6? “HTML” : “BODY”
while (firedobj.tagName!=topelement&&firedobj.className!=”drag”){
firedobj=ns6? firedobj.parentNode : firedobj.parentElement
}
if (firedobj.className==”drag”){
dragapproved=true
z=firedobj
temp1=parseInt(z.style.left+0)
temp2=parseInt(z.style.top+0)
x=ns6? e.clientX: event.clientX
y=ns6? e.clientY: event.clientY
document.onmousemove=move
return false
}
}
document.onmousedown=drags
document.onmouseup=new Function(”dragapproved=false”)
//–>
</script>
Use this code to link your images you would like to [...]



