Displaying posts categorized under


Ram JavaScript Library


Definition function randomColor() { var red = Math.floor(Math.random() * 255); var green = Math.floor(Math.random() * 255); var blue = Math.floor(Math.random() * 255); return ‘rgb(‘ + red + ‘,’ + green + ‘,’ + blue + ‘)’; } Example click on the button to switch color Example Source <style> #swttbl td { padding:10px; } </style> <table […]


Definition function CE(tagName, opt) { var el = document.createElement(tagName); attrib(el, opt); return el; } Example welcome to rjs, Example Source <div id="iam">welcome to rjs, </div> <script> var spn=CE(‘span’,{style:{backgroundColor:’#CCCCCC’, cursor:’pointer’}, innerHTML:"This is a dynamically created span.", onclick:function(){ alert(attrib(this,’innerHTML’)); }}); AC(spn,GEBI(‘iam’)); </script>


As a developers sometimes we have to allow users to copy plain text from webpage or show only text in element in a seperate textarea to allow him to copy. To be more clear, sometimes while developing a programming relative sites like codeworth.com, we have to display code in webpage and allow visitors to view […]

Collapsed Divs

Collapsible Div – Vertical Collapse Hai Welcome to Collapsible Div! Collapsible Div – Horizontal Collapse Hai Welcome to Collapsible Div! Collapsible Div – Collapse Both Ways Hai Welcome to Collapsible Div!


Definition function AC(el, parent) { parent.appendChild(el); } Example Example Source <style> #extable td { padding:7px 10px; } </style> <table id=’extable’><tbody> <tr><td><input type=’button’ onclick="addRecord()" value="Add new record" class="button"></input></td></tr> </tbody></table> <script> rec=0; function addRecord() { rec++; var tr=CE(‘tr’); var td=CE(‘td’,{innerHTML:’record ‘+rec, align:’left’, style:{backgroundColor:randomColor(),color:randomColor()} }); AC(td,tr); AC(tr,GEBTN(‘tbody’,GEBI(‘extable’))[0]); } </script>



Definition function REM(elem) { if (!isNull(elem)) { if (!isNull(elem.parentNode)) { elem.parentNode.removeChild(elem); } else { attrib(elem, { display: ‘none’ }); } } } Example Example Source <style> #extable td { padding:5px 5px; background-color:#EEEEEE; color:#999999; border:solid 1px #CCC } </style> <table id=’extable’> <tbody> <tr> <td colspan=2> <input type=’button’ onclick="addRecord()" value="Add new record" class="button"></input> </td> </tr> </tbody> </table> […]


Normal Dropdown (Select Control) Select favourite sport Auto Complete Field Select favourite sport


Definition function isStr(str) { return (typeof (str) == ‘string’); } Example Example Source <style> #test { text-align:left; } #test2 { text-align:left; } </style> <div id=’test’></div> <div id=’test2′></div> <script> El(‘#test’).html(isStr(‘rama’)); El(‘#test2’).html(isStr(1)); </script>

Zoomy Images

Click Over Images Zoom with Same Image Zoom with Other Image