Coda Clips

Ajax - XMLHtmlRequest with "TOGGLE" effect

<script type="text/javascript">
function script()
{
var e = document.getElementById();
	if(e.innerHTML == "")	
{
var oRequest;
try {
       oRequest=new XMLHttpRequest();
    } catch (e)   {
    try {
         oRequest=new ActiveXObject("Msxml2.XMLHTTP");
         } catch (e) {
         try {
             oRequest=new ActiveXObject("Microsoft.XMLHTTP");
              } catch (e) {
                  alert("AJAX IS NOT SUPPORTED");
                 return false;
              }
        }
     }
  oRequest.onreadystatechange=function() {
   if(oRequest.readyState==4)
     {
         document.getElementById().innerHTML = oRequest.responseText;
     }
   }
 oRequest.open("GET","",true);
 oRequest.send(null);
 }
 else
	{e.innerHTML = "";}
	}
</script>

Added to by Dawson

Install Clip


Ajax - XMLHtmlRequest

<script type="text/javascript">
function script()
{
var e = document.getElementById("");
var oRequest;
try {
       oRequest=new XMLHttpRequest();
    } catch (e)   {
    try {
         oRequest=new ActiveXObject("Msxml2.XMLHTTP");
         } catch (e) {
         try {
             oRequest=new ActiveXObject("Microsoft.XMLHTTP");
              } catch (e) {
                  alert("YOUR BROWSER DOESN'T SUPPORT AJAX!");
                 return false;
              }
        }
     }
  oRequest.onreadystatechange=function() {
   if(oRequest.readyState==4)
     {
         document.getElementById("").innerHTML = oRequest.responseText;
     }
   }
 oRequest.open("GET",,true);
 oRequest.send(null);
 }
</script>

Added to by Dawson

Install Clip


Unify Div Heights (using jQuery)

// Make the height of all the innerDivs the same height based on the tallest one.
  function unifyHeights() 
  {
    var maxHeight = 0;
    $('div#OuterContainer').children('div').each(function(){
      var height = $(this).outerHeight();
      //alert(height);
      if ( height > maxHeight ) { maxHeight = height; }
    });
    $('div.innerDivs').css('height', maxHeight);
  }

Added to by Michael D. Noga

Install Clip


Get Value of Select and Load external file to div (jQuery)

$(document).ready(function(){
   $('#contactFormSelect :selected').val();
       $("#contactFormSelect").change(function(){
           $('#formLoader').load($('#contactFormSelect').val());
       });
});

Added to by Mark Evans

Install Clip


Textarea Character Count (jQuery)

// controls character input/counter
$('textarea#body').keyup(function() {
var charLength = $(this).val().length;
// Displays count
$('span#charCount').html(charLength + ' of 250 characters used');
// Alerts when 250 characters is reached
if($(this).val().length > 250)
$('span#charCount').html('<strong>You may only have up to 250 characters.</strong>');
});

Added to by Mark Evans

Install Clip


jQuery Action

<script type="text/javascript">
$(document).ready(function() { 
/*place jQuery actions here*/ 
<<**SelectionInsertionPlaceholder**>>
}); 
</script>

Added to by Matthew Hunt

Install Clip


Adding Mint to your site

<script src="/mint/?js" type="text/javascript"></script>

Added to by Sam Brown

Install Clip


JavaScript Include

<script type="text/javascript" src="<<**SelectionInsertionPlaceholder**>>"></script>

Added to by Sam Brown

Install Clip