George Mason University Antonin Scalia Law School

Events Planning Form Using Javascript

A short questionnaire to direct users to the right form using Javscript window.onload = function() { document.getElementById(‘link1’).style.display = ‘none’; document.getElementById(‘link2’).style.display = ‘none’; }; //Clears div box var x, y, z; //assigns variables to radio selections function a1(answer1){ x = answer1; }; function a2(answer2){ y = answer2; }; function a3(answer3){ z = answer3; }; //if all … Continue reading “Events Planning Form Using Javascript”

Homepage Featured Events Display Using DOM

The featured events on the Mason Law homepage is pulled from the master calendar’s RSS. To get the dates and times separated from the titles, accessing the DOM is needed. The following codes, which requires jQuery, make the magic happened: $(‘.rssItemLink’).each( function(){ $this = $(this); $this. html(‘<em>’ + $this. html(). replace(/((\d{1,2}\/){2}\d{2,4}\s*[0-9]{1,2}:[0-9]{1,2}\s*[apAP][mM]\s*to\s*[0-9]{1,2}:[0-9]{1,2}\s*[apAP][mM])/, ‘</em><b>$1</b>’ ) ); } );

Sticky Nav on Scroll

Here’s a little JavaScript function to make your site’s header or navigation stick to the top of the window when users scroll the page: HTML: <div id=”navigation”> <!– your navigation code –> </div> CSS: #navigation{ position:absolute; top:120px; left:0; } #navigation.fixed{ position:fixed; top:16px; } JavaScript: // Handles the page being scrolled by ensuring the navigation is … Continue reading “Sticky Nav on Scroll”