Snippet-List - See Snippets tab in Dreamweaver |
||
A - Headers |
||
B - Navigation |
||
C - Form Elements |
||
D - Java - Scripts |
||
E - Meta & Text |
||
F - Footers |
||
| -- | -- |
-- |
*******************************************************************
*******************************************************************
Snippet Group- A - Headers
1 -
| Lorem | Ipsum | Dolar | Sic |
2 -
| Lorem | Ipsum | Dolar | Sic |
3 -
| Lorem ipsum dolor sit amet, consetetur sadipscing elitr | |||
4 -
| Lorem Ipsum Dolar Sic Amet: Consetetur Sadipscing Elitr |
|
| Sed Diam Nonumy |
5 -
- -
*******************************************************************
*******************************************************************
Snippet Group- B - Navigation
1 -
| Lorem | > | Ipsum | > | Dolar | > | Amit |
| Lorem | | Ipsum | | Dolar | | Amit | | Consetetur | | Sadipscing |
| Lorem | | | Ipsum | | | Dolar | | | Amit | | | Consetetur | | | Sadipscing |
|
2 -
| Lorem | 1 2 3 4 5 6 7 8 9 10 | Ipsum |
| <-- Lorem | Ipsum --> |
| < | > |
3 -
| Lorem | Ipsum | Dolar | Amit | |||||||
4 -
|
| Lorem | |
| Ipsum | |
| | Dolar |
| | Sic Amet |
| Consetetur | |
| | Lorem |
| | Ipsum |
| | Dolar |
5 -
- -
*******************************************************************
*******************************************************************
Snippet Group- C - Form Elements
1 -
2 -
3 -
4 -
5 -
- -
*******************************************************************
*******************************************************************
Snippet Group- D - Java Scripts
1 - Browser functions
--- Browser detection----------- - function redirect of browser
function redirect(URLStr) { location = URLStr; }
- - printPage
function printPage() { print(document); }
- - setStatusBar
function setStatusBar(msgStr) { self.status = msgStr; }
- -
2 - Cookies
- - Read Cookie
- - Write Cookie
- - get mouse location
/*
Example:
function test()
{
if (document.layers) getMouseLoc; //NS
else if (document.all) getMouseLoc(); //IE
alert(mouseLocation.x+","+mouseLocation.y);
}
in the BODY:
test
*/
function Point(x,y) { this.x = x; this.y = y; }
mouseLocation = new Point(-500,-500);
function getMouseLoc(e)
{
if(!document.all) //NS
{
mouseLocation.x = e.pageX;
mouseLocation.y = e.pageY;
}
else //IE
{
mouseLocation.x = event.x + document.body.scrollLeft;
mouseLocation.y = event.y + document.body.scrollTop;
}
return true;
}
//NS init:
if(document.layers){ document.captureEvents(Event.MOUSEMOVE); document.onMouseMove = getMouseLoc; }
3 - Images
Slide Show -- // * Dependencies * // this function requires the following snippets: // JavaScript/images/switchImage // // BODY Example: // //
//
//
// SCRIPT Example:
// var mySlideList1 = ['image1.gif', 'image2.gif', 'image3.gif'];
// var mySlideShow1 = new SlideShow(mySlideList1, 'slide1', 3000, "mySlideShow1");
// var mySlideList2 = ['image4.gif', 'image5.gif', 'image6.gif'];
// var mySlideShow2 = new SlideShow(mySlideList2, 'slide2', 1000, "mySlideShow2");
function SlideShow(slideList, image, speed, name)
{
this.slideList = slideList;
this.image = image;
this.speed = speed;
this.name = name;
this.current = 0;
this.timer = 0;
}
SlideShow.prototype.play = SlideShow_play;
function SlideShow_play()
{
with(this)
{
if(current++ == slideList.length-1) current = 0;
switchImage(image, slideList[current]);
clearTimeout(timer);
timer = setTimeout(name+'.play()', speed);
}
}
- - Switch Image
function switchImage(imgName, imgSrc) { if (document.images) { if (imgSrc != "none") { document.images[imgName].src = imgSrc; } } }- - Simple Preload
// Example: // simplePreload( '01.gif', '02.gif' ); function simplePreload() { var args = simplePreload.arguments; document.imageArray = new Array(args.length); for(var i=0; i- - Capitalize Words
function capitalizeWords(string) { var tmpStr, tmpChar, preString, postString, strlen; tmpStr = string.toLowerCase(); stringLen = tmpStr.length; if (stringLen > 0) { for (i = 0; i < stringLen; i++) { if (i == 0) { tmpChar = tmpStr.substring(0,1).toUpperCase(); postString = tmpStr.substring(1,stringLen); tmpStr = tmpChar + postString; } else { tmpChar = tmpStr.substring(i,i+1); if (tmpChar == " " && i < (stringLen-1)) { tmpChar = tmpStr.substring(i+1,i+2).toUpperCase(); preString = tmpStr.substring(0,i+1); postString = tmpStr.substring(i+2,stringLen); tmpStr = preString + tmpChar + postString; } } } } return tmpStr; }- - Count Words
function howManyWords(inputString) { return inputString.split(' ').length; }- - Only Numbers
function onlyNumbers(inputString) { var searchForNumbers = /\D+\_+\W+\s+\S+/ (searchForNumbers.test(inputString)) ? return false : return true; }- -
5 - Others
Area of Rectangle-- function areaOfRectangle(width, height) { return width * height; }
6 - Windows---
-- alert
alert(messageStr);-- Confirm
confirm(messageStr);-- Message Box
// Example: // value1 = 3; value2 = 4; // messageBox("text message %s and %s", value1, value2); // this message box will display the text "text message 3 and 4" function messageBox() { var i, msg = "", argNum = 0, startPos; var args = messageBox.arguments; var numArgs = args.length; if(numArgs) { theStr = args[argNum++]; startPos = 0; endPos = theStr.indexOf("%s",startPos); if(endPos == -1) endPos = theStr.length; while(startPos < theStr.length) { msg += theStr.substring(startPos,endPos); if (argNum < numArgs) msg += args[argNum++]; startPos = endPos+2; endPos = theStr.indexOf("%s",startPos); if (endPos == -1) endPos = theStr.length; } if (!msg) msg = args[0]; } alert(msg); }-- Message Window
function messageWindow(title, msg) { var width="300", height="125"; var left = (screen.width/2) - width/2; var top = (screen.height/2) - height/2; var styleStr = 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbar=no,resizable=no,copyhistory=yes,width='+width+',height='+height+',left='+left+',top='+top+',screenX='+left+',screenY='+top; var msgWindow = window.open("","msgWindow", styleStr); var head = '-- Pop-Up Window
var popUpWin=0; function popUpWindow(URLStr, left, top, width, height) { if(popUpWin) { if(!popUpWin.closed) popUpWin.close(); } popUpWin = open(URLStr, 'popUpWin', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=yes,width='+width+',height='+height+',left='+left+', top='+top+',screenX='+left+',screenY='+top+''); }
*******************************************************************
*******************************************************************
Snippet Group- E - Meta & Text
1 - Meta - Do Not Cache
2 - Text - dif link color
xxx3 -
- -
*******************************************************************
*******************************************************************
Snippet Group- F - Footers
1 - Title and Hanging List
| Lorem: | Lorum | Ipsum | Dolar | Sic Amet | Consectetur | Lorum | Ipsum | Dolar | Sic Amet | Consectetur |
2 - Two Columns
| ©2001 Lorem Ipsum Dolar Sic Amet Consectetur | Lorum Ipsum Dolar Sic Amet Consectetur |
3 -
- -
*******************************************************************
*******************************************************************