Posts

Collapsible Div

<script language="javascript"> function togglefun() {     var ele = document.getElementById("toggleText");     var text = document.getElementById("displayText");     if(ele.style.display == "block") {             ele.style.display = "none";         text.innerHTML = "[+]";       }     else {         ele.style.display = "block";         text.innerHTML = "[-]";     } } </script> <a id="displayText" href="javascript:togglefun();">[+]</a> Click here <div id="toggleText" style="display: none"><h1>Iam Collapsible Div</h1></div>

Email Validation in coldfusion

 <cfif isDefined("form.MailTo")>     <cfset valid = REFind("^[a-zA-Z][\w\.-]*[a-zA-Z0-9]@[a-zA-Z][\w\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z]$", Trim(form.MailTo), 1) gt 0>     <cfif (form.MailTo NEQ 'Enter an email address') AND (form.MailTo NEQ '') AND (valid EQ 'YES')  >          <cfmail to = "#form.MailTo#" from = "xyz@mail.com" subject = "test"  type="text/html" >                   test             </cfmail>           <div ><h2>Email sent successfully!</h2><p>to:  <cfoutput>#form.MailTo#</cfoutput></p></div>     <cfelse>         <div ><h2>Email not sent. No valid email address supplied.</h2></div>     </cfif> </cfif> <form action = " " method="post" >         <h2>Email to:</h2> <input type = "Text" name =

Coldfusion code to remove illegal characters

<cfset s="FFFFt frgrth @!$?BNBNMJK %^&*()  LÖÖҗҢџьлÖҗҢџьлÖҗҢџьлÖҗҢџьлJLUIOUIO">  <cfset a=REReplace(s, '[^\x00-\x7F]', ' ', "ALL")>  <cfoutput>#a#</cfoutput>

javascript Div pop up

<style type="text/css">     #popup      {         background-color:#111;         opacity: 0.65;         filter:alpha(opacity=65);         position:absolute;         z-index: 6001;         top:0px;         left:0px;         width:100%;      }     #popUpDiv      {         position:absolute;         background-color:#eeeeee;         width:300px;         height:300px;         z-index: 6002;     }    </style> <script type="text/javascript">     function toggle(div_id)       {           var el = document.getElementById(div_id);           if ( el.style.display == 'none' ) { el.style.display = 'block';}           else {el.style.display = 'none';}       }     function popup_size(popUpDivVar)        {           if (typeof window.innerWidth != 'undefined')            {              viewportheight = window.innerHeight;            }           else            {              viewportheight = doc

how to limit the number of characters in textarea

<script language="javascript" type="text/javascript"> function limitText(limitField, limitCount, limitNum) {     if (limitField.value.length > limitNum) {         limitField.value = limitField.value.substring(0, limitNum);         alert("your message exceeds the limit");     } else {         limitCount.value = limitNum - limitField.value.length;     } } </script> <form name="myform" action=""> <textarea id="t1" name="description" onpropertychange="limitText(this.form.description,this.form.countdown,10);"  OnInput="limitText(this.form.description,this.form.countdown,10);" onKeyDown="limitText(this.form.description,this.form.countdown,10);" rows="20" cols="40"> </textarea><br> <font size="1">(Maximum characters: 10)<br> You have <input readonly type="text" name="countdown&quo

code similar to cflocation which gives a pop up message

<html> <head> <script type="text/javascript"> var t = 1000; function display() { var msg = confirm("activity is successful without attachment"); if (msg) location.href="http://shemy-coldfusion.blogspot.in"; else location.href="http://www.google.com"; } </script> </head> <body onLoad="javascript:setTimeout('display()', t);"> </body> </html>

Progress Bar in coldfusion

<html>     <head>         <script>             function init()                 {                      ColdFusion.ProgressBar.start("pb")                }         </script>     </head>     <body>         <h2>Processing....</h2>         <cfprogressbar name="pb" duration="5000" interval="20" width="300" />         <cfset ajaxOnLoad("init")>     </body> </html>