Append to Article Body
var obj = document.getElementById('body'); obj.value = obj.value+"SOME TEXT";
11381 users tagging and storing useful source code snippets
Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world
var obj = document.getElementById('body'); obj.value = obj.value+"SOME TEXT";
/* also - custom-1, custom-2, custom-3, custom-4, custom-5, etc for custom fields. */ var obj = document.getElementById('custom-3'); obj.value = "VALUE";
function encode(string) { return string.replace('&','&').replace('<','<').replace('>','>').replace('\'',''').replace('"','"'); }
function pause(millisecondi) { var now = new Date(); var exitTime = now.getTime() + millisecondi; while(true) { now = new Date(); if(now.getTime() > exitTime) return; } }
$("a.codeButtonB").click(function(){$("pre.codeB").toggle()});
$("#item li, #otheritem li").click(function(){ $(this).css('color', '#c00'); });
//this part goes within the head tags <link rel="stylesheet" type="text/css" href="standard.css" title="standard" /> <link rel="alternate stylesheet" type="text/css" href="medium.css" title="medium" /> <link rel="alternate stylesheet" type="text/css" href="large.css" title="large" /> <script src="fontsize.js" type="text/javascript" language="javascript"></script> //this part goes where you want the links that the user will click on to show up (the script part should probably be on one line with no breaks <td valign="top" id="adjustcell"> <script type="text/javascript"> if (document.getElementById){ document.getElementById('adjustcell').innerHTML = '<table width="100" cellspacing="0" cellpadding="0" border="0"><tr> <td colspan="4" height="10"> </td></tr><tr><td width="25"> </td><td width="25"><a href="#" onclick="setActiveStyleSheet(\'default\'); return false;">normal text size</a></td> <td width="25"><a href="#" onclick="setActiveStyleSheet(\'medium\'); return false;">medium text size</a></td> <td width="25"><a href="#" onclick="setActiveStyleSheet(\'large\'); return false;">large text size</a></td> </tr> <tr><td width="100" align="right" colspan="4" style="color: #ffffff;">Adjust Text Size</td></tr></table>';} </script> </td> //contents of fontsizeswitcher.js (some of this is to switch images if you are using images instead of text links. // var graphics_path = "" ; var graphics_init = 0 ; function init_path() { graphics_path = document.getElementById("default").src ; // "graphics" ; graphics_path = graphics_path.substring(0,graphics_path.lastIndexOf("/")); graphics_path = graphics_path.substring(graphics_path.indexOf(".com/")+4); graphics_init = 1 ; } function setActiveStyleSheet(title) { var i, a, main; for(i=0; (a = document.getElementsByTagName("link")[i]); i++) { if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title")) { a.disabled = true; if(a.getAttribute("title") == title) { a.disabled = false; } } } pressButton(title); } function unpressButton(which) { if ( graphics_init == 0 ) { init_path() } document.getElementById(which).src = graphics_path + "/" + which + ".gif"; } switchButtons = ["default", "medium", "large"]; function pressButton(which) { if ( graphics_init == 0 ) { init_path() } for (i = 0; i < switchButtons.length; i++) { if (which == switchButtons[i]) { document.getElementById(which).src = graphics_path + "/" + which + "_p.gif"; } else { document.getElementById(switchButtons[i]).src = graphics_path + "/" + switchButtons[i] + ".gif"; } } if (which == "null") { document.getElementById("default").src = graphics_path + "/default_p.gif"; } } function getActiveStyleSheet() { var i, a; for(i=0; (a = document.getElementsByTagName("link")[i]); i++) { if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title") && !a.disabled) { return a.getAttribute("title"); } } return null; } function getPreferredStyleSheet() { var i, a; for(i=0; (a = document.getElementsByTagName("link")[i]); i++) { if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("rel").indexOf("alt") == -1 && a.getAttribute("title") ) return a.getAttribute("title"); } return null; } function createCookie(name,value,days) { if (days) { var date = new Date(); date.setTime(date.getTime()+(days*24*60*60*1000)); var expires = "; expires="+date.toGMTString(); } else { expires = ""; } document.cookie = name+"="+value+expires+"; path=/"; } function readCookie(name) { var nameEQ = name + "="; var ca = document.cookie.split(';'); for(var i=0;i < ca.length;i++) { var c = ca[i]; while (c.charAt(0)==' ') c = c.substring(1,c.length); if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length); } return null; } window.onload = function(e) { if ( graphics_init == 0 ) { init_path() } smallpressed = new Image(); smallpressed.src=graphics_path + "/default_p.gif" medpressed = new Image(); medpressed.src=graphics_path + "/medium_p.gif" largepressed = new Image(); largepressed.src=graphics_path + "/large_p.gif" if (document.getElementById) { var cookie = readCookie("style"); var title = cookie ? cookie : getPreferredStyleSheet(); setActiveStyleSheet(title); } } window.onunload = function(e) { var title = getActiveStyleSheet(); createCookie("style", title, 365); }
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>JSOV - JavaScript Object Viewer</title> <meta name="robots" content="follow,index" /> </head> <style type="text/css"> body {font-family: Verdana, Tahoma, Arial; font-size: 12px; } div {display: inline;} a,a:link,a:hover {text-decoration: none; color:blue; } .o_prop_name {font-weight: bold; color: blue; font-size: 14px; } .o_prop_value {font-weight: bold; color: green; } </style> <script language="javascript" type="text/javascript"> /* appName: JSOV 0.1 Author: Billy Chow Webpage: http://www.dreammx.com E-mail: billychow#tom.com */ function showObj(obj) { var obj= eval(obj); var str='<div class="formated">'; for (prop in obj) { str +='<div class="o_prop_name"><a href="#" title="next" onClick="changeObj(this.innerText)">' +prop+ '</a></div>=<div class="o_prop_value">' +obj[prop]+ '</div><br />'; } str += '</div>'; document.all.txt3.innerHTML=str; } function changeObj(txt) { var prefix = document.all.txtObj.value; document.all.txtObj.value = prefix+'.'+txt; showObj(document.all.txtObj.value); } function eraser() { var tmpstr = document.all.txtObj.value; tmpstr=tmpstr.replace(/\.\w*$/ig,""); document.all.txtObj.value=tmpstr; showObj(tmpstr); } </script> <body> <h1>JavaScript Object Viewer 0.1</h1> <div id="txt1"> Input your object name here: <input type="text" name="txtObj" value="window" /> <input type="button" name="btnSubmit" value="View" onClick="showObj(document.all.txtObj.value);" /> <input type="button" name="btnBack" value="Back" onClick="eraser();" /> <input type="button" name="btnDisp" value="DispVal" onClick="alert(eval(document.all.txtObj.value));" /> </form> </div> <br /> <div id="txt2">The Object has these attributes:</div> <hr noshade="noshade" /> <div id="txt3"> </div> </body> </html>
<SCRIPT LANGUAGE=JAVASCRIPT> <!-- if (top.location !== self.location) { top.location=self.location; } </SCRIPT>
function KeyDown(){ //å±?è”½é¼ æ ‡å?³é”®ã€?Ctrl+nã€?shift+F10ã€?F5刷新ã€?é€€æ ¼é”® //alert("ASCII代ç ?是:"+event.keyCode); if ((window.event.altKey)&& ((window.event.keyCode==37)|| //å±?蔽 Alt+ æ–¹å?‘é”® â†? (window.event.keyCode==39))){ //å±?蔽 Alt+ æ–¹å?‘é”® → alert("ä¸?å‡†ä½ ä½¿ç”¨ALT+æ–¹å?‘é”®å‰?进或å?Žé€€ç½‘页ï¼?"); event.returnValue=false; } if ((event.keyCode==8) || //å±?è”½é€€æ ¼åˆ é™¤é”® (event.keyCode==116)|| //å±?蔽 F5 刷新键 (event.keyCode==112)|| //å±?蔽 F1 刷新键 (event.ctrlKey && event.keyCode==82)){ //Ctrl + R event.keyCode=0; event.returnValue=false; } if ((event.ctrlKey)&&(event.keyCode==78)) //å±?蔽 Ctrl+n event.returnValue=false; if ((event.shiftKey)&&(event.keyCode==121)) //å±?蔽 shift+F10 event.returnValue=false; if (window.event.srcElement.tagName == "A" && window.event.shiftKey) window.event.returnValue = false; //å±?蔽 shift åŠ é¼ æ ‡å·¦é”®æ–°å¼€ä¸€ç½‘é¡µ if ((window.event.altKey)&&(window.event.keyCode==115)){ //å±?蔽Alt+F4 window.showModelessDialog("about:blank","","dialogWidth:1px;dialogheight:1px"); return false;} }