The forum of the forums
Would you like to react to this message? Create an account in a few clicks or log in to continue.

Common and nifty javascript codes!

+2
Cornelia
Bear queen
6 posters

Go down

javascr - Common and nifty javascript codes! Empty Common and nifty javascript codes!

Post by Bear queen December 8th 2008, 12:48 am

I just thought i would post some common nifty codes to use on your forum! Feel free to add or rate any codes you like to use!!copy and paste under Display: Homepage: Generalities

Snow maker:
Code:
<script>
// CREDITS: // Snowmaker Copyright (c) 2003 Peter Gehrig. All rights reserved.
// Distributed by http://www.hypergurl.com // Permission given to use the script
on webpages provided that this notice remains as is. // Set the number of snowflakes
(more than 30 - 40 not recommended) var snowmax=35 // Set the colors for the snow.
Add as many colors as you like var snowcolor=new Array("#aaaacc","#ddddFF","#ccccDD")
// Set the fonts, that create the snowflakes. Add as many fonts as you like var
snowtype=new Array("Arial Black","Arial Narrow","Times","Comic
Sans MS") // Set the letter that creates your snowflake (recommended:*) var
snowletter="*" // Set the speed of sinking (recommended values range
from 0.3 to 2) var sinkspeed=0.6 // Set the maximal-size of your snowflaxes var
snowmaxsize=22 // Set the minimal-size of your snowflaxes var snowminsize=8 //
Set the snowing-zone // Set 1 for all-over-snowing, set 2 for left-side-snowing
// Set 3 for center-snowing, set 4 for right-side-snowing var snowingzone=3 ///////////////////////////////////////////////////////////////////////////
// CONFIGURATION ENDS HERE ///////////////////////////////////////////////////////////////////////////
// Do not edit below this line var snow=new Array() var marginbottom var marginright
var timer var i_snow=0 var x_mv=new Array(); var crds=new Array(); var lftrght=new
Array(); var browserinfos=navigator.userAgent var ie5=document.all&&document.getElementById&&!browserinfos.match(/Opera/)
var ns6=document.getElementById&&!document.all var opera=browserinfos.match(/Opera/)
var browserok=ie5||ns6||opera function randommaker(range) { rand=Math.floor(range*Math.random())
return rand } function initsnow() { if (ie5 || opera) { marginbottom = document.body.clientHeight
marginright = document.body.clientWidth } else if (ns6) { marginbottom = window.innerHeight
marginright = window.innerWidth } var snowsizerange=snowmaxsize-snowminsize for
(i=0;i<=snowmax;i++) { crds[i] = 0; lftrght[i] = Math.random()*15; x_mv[i]
= 0.03 + Math.random()/10; snow[i]=document.getElementById("s"+i) snow[i].style.fontFamily=snowtype[randommaker(snowtype.length)]
snow[i].size=randommaker(snowsizerange)+snowminsize snow[i].style.fontSize=snow[i].size
snow[i].style.color=snowcolor[randommaker(snowcolor.length)] snow[i].sink=sinkspeed*snow[i].size/5
if (snowingzone==1) {snow[i].posx=randommaker(marginright-snow[i].size)} if (snowingzone==2)
{snow[i].posx=randommaker(marginright/2-snow[i].size)} if (snowingzone==3) {snow[i].posx=randommaker(marginright/2-snow[i].size)+marginright/4}
if (snowingzone==4) {snow[i].posx=randommaker(marginright/2-snow[i].size)+marginright/2}
snow[i].posy=randommaker(2*marginbottom-marginbottom-2*snow[i].size) snow[i].style.left=snow[i].posx
snow[i].style.top=snow[i].posy } movesnow() } function movesnow() { for (i=0;i<=snowmax;i++)
{ crds[i] += x_mv[i]; snow[i].posy+=snow[i].sink snow[i].style.left=snow[i].posx+lftrght[i]*Math.sin(crds[i]);
snow[i].style.top=snow[i].posy if (snow[i].posy>=marginbottom-2*snow[i].size
|| parseInt(snow[i].style.left)>(marginright-3*lftrght[i])){ if (snowingzone==1)
{snow[i].posx=randommaker(marginright-snow[i].size)} if (snowingzone==2) {snow[i].posx=randommaker(marginright/2-snow[i].size)}
if (snowingzone==3) {snow[i].posx=randommaker(marginright/2-snow[i].size)+marginright/4}
if (snowingzone==4) {snow[i].posx=randommaker(marginright/2-snow[i].size)+marginright/2}
snow[i].posy=0 } } var timer=setTimeout("movesnow()",50) } for (i=0;i<=snowmax;i++)
{ document.write("<span id='s"+i+"' style='position:absolute;top:-"+snowmaxsize+"'>"+snowletter+"</span>")
} if (browserok) { window.onload=initsnow } </script>

Mini Pop-up on enter, click ok to continue. Make sure you enter text!
Code:
<script> function MYALERT() {
alert("YOUR TEXT HERE"); } MYALERT()
</script>

Flashing Message On Top: Flashes and is in front on your screen. Make sure you enter text!
Code:
<script> //enter your message
in this part, including any html tags var message='<center><b><font
color=blue size=4><a href="hosting.html">Webhosting with simply
super support!<br>Click Here!</a></font></b></center>'
//enter a color name or hex value to be used as the background color of the message.
Don't use hash # sign var backgroundcolor="red" //enter 0 for always
display, 1 for a set period, 2 for random display mode var displaymode=0 //if
displaymode is set to display for a set period, enter the period below (1000=1
sec) var displayduration=10000 //enter 0 for non-flashing message, 1 for flashing
var flashmode=1 //if above is set to flashing, enter the flash-to color below
var flashtocolor="yellow" ///////////////do not edit below this line////////////////////////////////////////
<!-- script distributed by http://www.hypergurl.com function regenerate(){
window.location.reload() } var which=0 function regenerate2(){ if (document.layers)
setTimeout("window.onresize=regenerate",400) } function display2(){
if (document.layers){ if (topmsg.visibility=="show") topmsg.visibility="hide"
else topmsg.visibility="show" } else if (document.all){ if (topmsg.style.visibility=="visible")
topmsg.style.visibility="hidden" else topmsg.style.visibility="visible"
setTimeout("display2()",Math.round(Math.random()*10000)+10000) } } function
flash(){ if (which==0){ if (document.layers) topmsg.bgColor=flashtocolor else
topmsg.style.backgroundColor=flashtocolor which=1 } else{ if (document.layers)
topmsg.bgColor=backgroundcolor else topmsg.style.backgroundColor=backgroundcolor
which=0 } } if (document.all){ document.write('<span id="topmsg"
style="position:absolute;visibility:hidden">'+message+'</span>')
} function logoit(){ document.all.topmsg.style.left=document.body.scrollLeft+document.body.clientWidth/2-document.all.topmsg.offsetWidth/2
document.all.topmsg.style.top=document.body.scrollTop+document.body.clientHeight-document.all.topmsg.offsetHeight-4
} function logoit2(){ topmsg.left=pageXOffset+window.innerWidth/2-topmsg.document.width/2
topmsg.top=pageYOffset+window.innerHeight-topmsg.document.height-5 setTimeout("logoit2()",90)
} function setmessage(){ document.all.topmsg.style.left=document.body.scrollLeft+document.body.clientWidth/2-document.all.topmsg.offsetWidth/2
document.all.topmsg.style.top=document.body.scrollTop+document.body.clientHeight-document.all.topmsg.offsetHeight-4
document.all.topmsg.style.backgroundColor=backgroundcolor document.all.topmsg.style.visibility="visible"
if (displaymode==1) setTimeout("topmsg.style.visibility='hidden'",displayduration)
else if (displaymode==2) display2() if (flashmode==1) setInterval("flash()",1000)
window.onscroll=logoit window.onresize=new Function("window.location.reload()")
} function setmessage2(){ topmsg=new Layer(window.innerWidth) topmsg.bgColor=backgroundcolor
regenerate2() topmsg.document.write(message) topmsg.document.close() logoit2()
topmsg.visibility="show" if (displaymode==1) setTimeout("topmsg.visibility='hide'",displayduration)
else if (displaymode==2) display2() if (flashmode==1) setInterval("flash()",1000)
} if (document.layers) window.onload=setmessage2 else if (document.all) window.onload=setmessage
end script --> </script>


If You Have Any More - Post Them!!
Please pm me for an questions!!

Find ALOT More at http://www.hypergurl.com/easyhtml.html
Bear queen
Bear queen
Forumember

Female Posts : 191
Reputation : 0
Language : English
Location : Earth!!

Back to top Go down

javascr - Common and nifty javascript codes! Empty Re: Common and nifty javascript codes!

Post by Cornelia December 8th 2008, 1:36 am

I just add notes :

- If you are using the phpBB2 version, you can edit your templates and add the script in the overall_header template, between <head> and </head> tags.

- If you are using another version, you can add short codes in the site description if there is enough place. This field can contain up to 127 characters.

- For the long codes (like the snow one), open your Notepad (Windows) or gedit/kate (Linux), then paste what is between <script> and </script>
Then save it under script.js (on Notepad : surround the name with quotation marks, so this will force the file to be saved into the right format).
Then host it on a Web host who accepts JS files (a FTP host, or a file host who accepts hotlinking, like fileden), then insert the script file URL in this following code you will insert in your site description :
Code:
<script type="text/javascript" src="http://YOUR_script_URL.js"></script>
Cornelia
Cornelia
Hyperactive

Female Posts : 4763
Reputation : 173
Language : I'M NOT A TECHIE OR A MOD, SO QUIT SENDING ME PMS FOR TECHIE STUFF OR LOST PASSWORDS !!!
Location : Absent on weekends until camping season ends

http://ishimaru-design.servhome.org

Back to top Go down

javascr - Common and nifty javascript codes! Empty Re: Common and nifty javascript codes!

Post by Bear queen December 9th 2008, 1:20 am

ok thanks!!
Bear queen
Bear queen
Forumember

Female Posts : 191
Reputation : 0
Language : English
Location : Earth!!

Back to top Go down

javascr - Common and nifty javascript codes! Empty Re: Common and nifty javascript codes!

Post by scripttester123 December 9th 2008, 1:48 am

Cornelia wrote:I just add notes :

- If you are using the phpBB2 version, you can edit your templates and add the script in the overall_header template, between <head> and </head> tags.

- If you are using another version, you can add short codes in the site description if there is enough place. This field can contain up to 127 characters.

- For the long codes (like the snow one), open your Notepad (Windows) or gedit/kate (Linux), then paste what is between <script> and </script>
Then save it under script.js (on Notepad : surround the name with quotation marks, so this will force the file to be saved into the right format).
Then host it on a Web host who accepts JS files (a FTP host, or a file host who accepts hotlinking, like fileden), then insert the script file URL in this following code you will insert in your site description :
Code:
<script type="text/javascript" src="http://YOUR_script_URL.js"></script>

Wow thanks for that. Very useful!
scripttester123
scripttester123
Forumember

Posts : 243
Reputation : 0
Language : english

Back to top Go down

javascr - Common and nifty javascript codes! Empty Re: Common and nifty javascript codes!

Post by Bear queen December 9th 2008, 11:04 pm

yeah!
Bear queen
Bear queen
Forumember

Female Posts : 191
Reputation : 0
Language : English
Location : Earth!!

Back to top Go down

javascr - Common and nifty javascript codes! Empty Re: Common and nifty javascript codes!

Post by Caihlem December 11th 2008, 8:09 pm

Hi,

Please send these by P.M to me under the form of a tutorial. If it's accepted, we'll gladly post it in the Tricks and Tips section Wink
Caihlem
Caihlem
Energetic

Male Posts : 8969
Reputation : 342
Language : English, French & Female
Location : You can't fly like the phenix

Back to top Go down

javascr - Common and nifty javascript codes! Empty Re: Common and nifty javascript codes!

Post by Doomie December 11th 2008, 8:44 pm

Thanks for your support Caihlem.
And a huge thank you to the share of info & links everyone!

Have a good day, and a happy Christmas! Very Happy
Doomie
Doomie
Forumember

Male Posts : 140
Reputation : 0
Language : English,Swedish,Arabic
Location : Gothenburg, Sweden

Back to top Go down

javascr - Common and nifty javascript codes! Empty Re: Common and nifty javascript codes!

Post by Nessa December 11th 2008, 9:13 pm

Oooh Caihlem, You forgot to lock it goober Laughing * Pokes you *



=>Locked
Nessa
Nessa
Energetic

Female Posts : 6203
Reputation : 128
Language : English

Back to top Go down

Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum