переход на Главную страницу...


Cкачать Java скрипты
(1-100)

01   02   03   04   05  
06   07   08   09   10  
11   12   13   14   15  
16   17   18   19   20  
21   22   23   24   25  
26   27   28   29   30  
31   32   33   34   35  
36   37   38   39   40  
41   42   43   44   45  
46   47   48   49   50  
51   52   53   54   55  
56   57   58   59   60  
61   62   63   64   65  
66   67   68   69   70  
71   72   73   74   75  
76   77   78   79   80  
81   82   83   84   85  
86   87   88   89   90  
91   92   93   94   95  
96   97   98   99   100  

бесплатные шаблоны
javascript для html


Java скрипт - Убить куки

Содержимое этой таблицы поместите между <HEAD> и </HEAD>

 

<SCRIPT LANGUAGE="javascript">

<!--

//behavior "Cookie Library"

// Copyright 1997 Webmonkey. All rights reserved.



//*************** LOCALIZEABLE GLOBALS VARS *****************


var MSG_AnchorNotFound = 'The anchor "%s" that was set to %s could not be found.';

var MSG_NoCookieValueSet = "Please provide a Cookie Name.";

var MSG_WrongNumberOfArgs = "The function call for this event has been corrupted. Please hit Cancel, delete the Action, and try again."


var TYPE_Separator = "in";

var TYPE_Form = "form";

var TYPE_Layer = "layer";

var TYPE_Image = "image";

var TYPE_Anchor = "anchor";


//Params for the WindowDimensions fn which improves performance by hardcoding window size.

var WINDOWSIZE_Autosize = false; //if you change the UI, set to true or update these numbers.

var WINDOWSIZE_Mac = "452,216"; //ignored if WINDOWSIZE_Autosize is true

var WINDOWSIZE_Win = "438,238"; //ignored if WINDOWSIZE_Autosize is true


//Note: HTML labels (at the end of this file) must be changed by hand



//*************** GLOBALS VARS *****************


var REF_UNNAMED = "unnamed <"; //this is what getObjectRefs() returns for unnamed objects

var REF_CANNOT = "cannot reference <";



//******************* BEHAVIOR FUNCTIONS **********************


function WM_killCookie(name, path, domain) {

var firstChar, lastChar, theValue;

// get the entire cookie string (this may have other name=value pairs in it

var theBigCookie = document.cookie;

// grab just this cookie from theBigCookie string

// find the start of 'name'

firstChar = theBigCookie.indexOf(name);

// if you found it

if(firstChar != -1) {

// skip 'name' and '='

firstChar += name.length + 1;

// find the end of the value string (i.e. the next ';')

lastChar = theBigCookie.indexOf(';', firstChar);

if(lastChar == -1) lastChar = theBigCookie.length;

// set theValue

theValue = theBigCookie.substring(firstChar, lastChar);

} else {

// there is no such cookie

theValue = false;

}

// assuming there actually is such a cookie

if(theValue) {

// set an expired cookie, adding 'path' and 'domain' if they were given

document.cookie = name + '=' + theValue + '; expires=Fri, 13-Apr-1970 00:00:00 GMT' + ((path)?';path=' + path:'') + ((domain)?';domain=' + domain:'');

}

}



//******************* API **********************



//Checks for the existence of anchors.

//If none exist, returns false so this Action is grayed out.


function canAcceptBehavior(){

return true;

}




//Returns Javascript functions to be inserted in HTML head with script tags.


function behaviorFunction(){

return "WM_killCookie";

}



//Returns fn call to insert in HTML tag <TAG... onEvent='thisFn(arg)'>

//Gets list of cookieValues from doc attribute. With each cookieValue, it gets the parallel

//anchor name from select 'menu'. Each cookieValue & anchorObj are embedded as args.


function applyBehavior(uniqueName) {

var i,argList="";


if (document.WM_cookieName) { //if not empty

//xxx

argList = "'" + document.WM_cookieName + "','" + document.WM_cookiePath + "','" + document.WM_cookieDomain + "'";


return "WM_killCookie("+argList+")"; //return fn call with args

} else {

return MSG_NoCookieValueSet;

}



}



//Given the original function call, this parses out the args and updates

//the UI. Loops through each anchorObj,cookieValue pair.

//If anchorObj already present in menu, stuff cookieValue in aHrefArray. If anchorObj

//doesn't exist, add to menu, and extend aHrefArray.


function inspectBehavior(behFnCallStr){


var argArray;

argArray = extractArgs(behFnCallStr); //get args

if (argArray.length == 4) {

document.theForm.cookieName.value = argArray[1];

document.theForm.cookiePath.value = argArray[2];

document.theForm.cookieDomain.value = argArray[3];


initializeUI();


} else alert(MSG_WrongNumberOfArgs);

}



//Used to improve performance, this hardcodes the expected window size. Without

//this fn, or if WINDOWSIZE_Autosize is true, DW will render the UI dynamically.

//IMPORTANT: for internationalization and other UI changes, update the globals.



//***************** LOCAL FUNCTIONS ******************


//Load the select menu with current hrefs.

//Also sets the global property WM_myAHrefs to the right num of items.


function initializeUI(){

storeCookieName();

storeCookiePath();

storeCookieDomain();

document.theForm.cookieName.focus(); //set focus on textbox

document.theForm.cookieName.select(); //set insertion point into textbox

}




//Given cookieName in form, looks up the menu's selection number, and stores the

//new href at that position in the global document property "WM_myDivColor".


function storeCookieName(){

var cookieName = document.theForm.cookieName.value;

document.WM_cookieName = cookieName; //rewrite global

}


function storeCookiePath(){

var cookiePath = document.theForm.cookiePath.value;

document.WM_cookiePath = cookiePath; //rewrite global

}


function storeCookieDomain(){

var cookieDomain = document.theForm.cookieDomain.value;

document.WM_cookieDomain = cookieDomain; //rewrite global

}



//**************** GENERIC FUNCTIONS ****************



//Given a function call, extracts the args and returns them in array

//Respects ', skips over stuff between quotes, and returns them dequoted.

//IMPORTANT: argArray[0] is the function call!! Actual args start at argArray[1].


function extractArgs(behFnCallStr){

var i, theStr, lastPos, argArray;


argArray = getTokens(behFnCallStr,"(),");

for (i=0; i<argArray.length; i++) {

theStr = unescQuotes(argArray[i]);

lastPos = theStr.length-1;

if (theStr.charAt(0) == "'" && lastPos > 0 && theStr.charAt(lastPos) == "'")

argArray[i] = theStr.substring(1,lastPos);

}

return argArray

}



//Given a string "myObject *" returns "myObject *".


function stripStar(theStr) {

var endPos;


endPos = theStr.indexOf(' *');

return ((endPos > 0)? theStr.substring(0,endPos) : theStr);

}




//Given theSelect obj and an index, it appends a star

//and inserts the new string into the menu at position index.

//If the menu item was "layer[2]" it becomes "layer[2] *".

//Existing " *" values get stripped off first.


function addStarToMenuItem(theSelect,menuIndex) {

var newMenuText;


newMenuText = stripStar(theSelect.options[menuIndex].text); //remove if old star

newMenuText += " *"; //append " *"

theSelect.options[menuIndex]=new Option(newMenuText); //add new line to menu

}




//Passed a string, finds special chars '"\ and escapes them with \


function escQuotes(theStr){

var i, theChar, escStr = "";

for(var i=0; i<theStr.length; i++) {

theChar = theStr.charAt(i);

escStr += (theChar=='"' || theChar=="'" || theChar=="\\")?("\\"+theChar):theChar;

}

return escStr;

}




//Passed a string, finds any escape chars \ and removes them


function unescQuotes(theStr){

var strLen, i, theChar, unescStr = "";

strLen = theStr.length;

for(i=0; i<strLen; i++) {

theChar = theStr.charAt(i);

if (theChar == "\\" && i < strLen - 1) //if escape char and not end

theChar = theStr.charAt(++i); //append next char and skip over

unescStr += theChar;

}

return unescStr;

}




//Converts an array of JS anchors to an array of their current urls.

//For example, document.links[0] becomes "http://bar.com/foo.html"


function niceNames(objRefArray,objTypeStr) {

var i, j, niceRef, tokens;

var niceNameArray = new Array(objRefArray.length);


for (i in objRefArray) { //with object reference array

tokens = getTokens(objRefArray[i],".").reverse(); //split ref into tokens and rev order

if (tokens.length > 1) {

niceRef = objTypeStr + ' ' + nameReduce(tokens[0]); //start building str

if (tokens.length > 2) { //reference includes some nesting...

if (tokens[1] != "document") //inside a form so add form reference

niceRef += ' ' + TYPE_Separator + ' ' + TYPE_Form + ' ' + nameReduce(tokens[1]);

for (j=1; j<tokens.length; j++) //add any layers

if (tokens[j].indexOf("layers[") == 0) //found a layer

niceRef += ' ' + TYPE_Separator + ' ' + TYPE_Anchor + ' ' + nameReduce(tokens[j]);

}

} else niceRef = objRefArray[i];

niceNameArray[i] = niceRef;

}

return niceNameArray;

}




//Extracts a name or num from array string and quotes if necessary. So

// myImg => "myImg"

// layers['foo'] => "foo"

// embeds[0] => 0

// myImg[2] => "myImg[2]"


function nameReduce (objName) {

var retVal, arrayTokens;


retVal = '"' + objName + '"'; //default is object wrapped in quotes

if (objName.indexOf("[") > 0) { //if it's an array

arrayTokens = getTokens(objName,"[]\"'"); //break up tokens

if (arrayTokens.length == 2) { //if exactly two tokens

if ("layers forms embeds links anchors all".indexOf(arrayTokens[0]) != -1) { //if legal

if (arrayTokens[1] == ""+parseInt(arrayTokens[1])) //if a number

retVal = arrayTokens[1];

else //else it's a string

retVal = '"' + arrayTokens[1] + '"';

}

}

}

return retVal;

}




//Emulates printf("blah blah %s blah %s",str1,str2)

//Used for concatenating error message for easier localization.

//Returns assembled string.


function errMsg() {

var i,numArgs,errStr="",argNum=0,startPos;


numArgs = errMsg.arguments.length;

if (numArgs) {

theStr = errMsg.arguments[argNum++];

startPos = 0; endPos = theStr.indexOf("%s",startPos);

if (endPos == -1) endPos = theStr.length;

while (startPos < theStr.length) {

errStr += theStr.substring(startPos,endPos);

if (argNum < numArgs) errStr += errMsg.arguments[argNum++];

startPos = endPos+2; endPos = theStr.indexOf("%s",startPos);

if (endPos == -1) endPos = theStr.length;

}

if (!errStr) errStr = errMsg.arguments[0];

}

return errStr;

}


function displayHelp() {

if (typeof window != 'undefined') window.open("http://www.webmonkey.com/") ;

}



//*************** END OF JAVASCRIPT *****************


function MM_popupMsg(theMsg) { //v1.2

alert(theMsg);

}

//-->

</SCRIPT>

 

Содержимое этой таблицы поместите между <BODY> и </BODY>

 

<body onLoad="initializeUI()">










<FORM NAME="theForm" ACTION="">

<DIV ALIGN="center">

<TABLE BORDER=0 bgcolor="#808080">

<tr> 

<td valign="top" rowspan="4"> 

&nbsp;

</td>

<td valign="top" align="left" colspan="3">
<p align="center"></font><font face="Arial Black, Arial, Helvetica, sans-serif" color="#FF0000" size="4">Убить
куки...&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font></p>
<p align="center">&nbsp;</p>
</td>

</tr>

<tr> 

<TD ALIGN="right" nowrap><font face="Verdana, Arial, Helvetica, sans-serif" size="2" color="#FFFFFF">Cookie 

Name:</font></TD>

<TD VALIGN="top" nowrap> 

<font size="3" color="#FFFFFF">

<INPUT NAME="cookieName" TYPE="text" SIZE="30" onBlur="storeCookieName();" value="myCookie">

</font>

</TD>

</TR>

<TR> 

<TD ALIGN="right" nowrap><font face="Verdana, Arial, Helvetica, sans-serif" size="2" color="#FFFFFF">Path:</font></TD>

<TD VALIGN="top" nowrap> 

<font size="3" color="#FFFFFF">

<INPUT NAME="cookiePath" TYPE="text" SIZE="30" onBlur="storeCookiePath();">

</font>

</TD>

</TR>

<TR> 

<TD ALIGN="right" nowrap><font face="Verdana, Arial, Helvetica, sans-serif" size="2" color="#FFFFFF">Domain:</font></TD>

<TD VALIGN="top" nowrap> 

<font size="3" color="#FFFFFF">

<INPUT NAME="cookieDomain" TYPE="text" SIZE="30" onBlur="storeCookieDomain();">

</font>

</TD>

</TR>

<font size="3" color="#000000">

<tr> 

<TD>&nbsp; </TD>

<TD colspan="2">
</font>
<font face="Verdana, Arial, Geneva, sans-serif" size="1" color="#FFFFFF">This 

function deletes the specified cookie from the current document's cookie 

file. If a PATH or DOMAIN was specified when the cookie was set, they 

must be specified in order to delete the cooke as well.&nbsp;

</font></TD>

</tr>

</TABLE>

</DIV>


</FORM>




      
Cкачать Java скрипты
(101-200)

101   102   103   104   105  
106   107   108   109   110  
111   112   113   114   115  
116   117   118   119   120  
121   122   123   124   125  
126   127   128   129   130  
131   132   133   134   135  
136   137   138   139   140  
141   142   143   144   145  
146   147   148   149   150  
151   152   153   154   155  
156   157   158   159   160  
161   162   163   164   165  
166   167   168   169   170  
171   172   173   174   175  
176   177   178   179   180  
181   182   183   184   185  
186   187   188   189   190  
191   192   193   194   195  
196   197   198   199   200  

скачать шаблоны
java script для html
  Книги   Скрипты     Анекдоты   Web Мастеру