Skip to content

Instantly share code, notes, and snippets.

View walterdavis's full-sized avatar

Walter Lee Davis walterdavis

View GitHub Profile
<!--[if IE]>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/prototype/1.6/prototype.js"></script>
<script type="text/javascript" charset="utf-8">
// <![CDATA[
$('myButton').observe('mouseover',function(evt){this.setStyle('background-position: 0 -30px');});
$('myButton').observe('mouseout',function(evt){this.setStyle('background-position: 0 0');});
// ]]>
</script>
<![endif]-->
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="600" height="500" id="600x500" align="middle">
<param name="allowScriptAccess" value="sameDomain"/>
<param name="movie" value="Resources/600x500.swf"/>
<param name="quality" value="high"/>
<param name="bgcolor" value="#FFFFFF"/>
<embed src="Resources/600x500.swf" quality="high" bgcolor="#FFFFFF" width="600" height="500" name="600x500" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"/>
</object>
var data = {
'Alameda' : {
'Parks and Recreation' : '123 Maple Lane<br />Some City, CA 22222<br />(222) 333-4444',
'Public Works' : '234 Maple Lane<br />Some City, CA 22222<br />(222) 444-5555',
'Waste Management' : '345 Maple Lane<br />Some City, CA 22222<br />(222) 555-6666'},
'Los Angeles' : {
'Parks and Recreation' : '123 Maple Lane<br />Los Angeles, CA 22222<br />(222) 333-4444',
'Public Works' : '234 Maple Lane<br />Los Angeles, CA 22222<br />(222) 444-5555',
'Waste Management' : '345 Maple Lane<br />Los Angeles, CA 22222<br />(222) 555-6666'}
}
var counties = new Element('select',{size:1,name:'counties'});
counties.options[0] = new Option('Choose a county','',true, false);
$H(data).keys().each(function(key){
counties.options[counties.options.length] = new Option(key, key, false, false);
});
$('someDivOnYourPage').insert(counties);
<?php
/**
* Monthly Image Script
* Create 12 images, place them in a folder called monthly_images in the same
* directory as your page. Set your page to a filename that ends in .php.
* Paste this code inside a Markup Item where you want the image to appear.
* Note that this will create an image tag with the actual dimensions of your
* photo. Also note that this will create an XHTML-format image tag, delete
* the trailing slash if you want to have it on an HTML page instead.
*
Object.extend(Glider.prototype,{
next: function(){
if (this.current) {
var currentIndex = this.current._index;
var nextIndex = (this.sections.length - 1 == currentIndex) ? 0 : currentIndex + 1;
} else var nextIndex = 1;
if(nextIndex > 0) this.moveTo(this.sections[nextIndex], this.scroller, {
duration: this.options.duration
});
var newsSource = $('data');
var newsDisplay = $('news_area');
var delayBetweenItems = 3;
var effectSpeed = 0.6;
var tag = newsSource.firstDescendant().tagName.toLowerCase();
tag = ($w('ol ul').include(tag)) ? 'li' : tag;
newsSource.hide();
var data = $$('#' + newsSource.id + ' > ' + tag).pluck('innerHTML');
var news = newsDisplay.down(tag).update(data.first());
var index = 0;
// jQuery
$(document).ready(function() {
var mouseX = 0;
var mouseY = 0;
$("#mytext").mousemove(function(e) {
// track mouse position
mouseX = e.pageX;
mouseY = e.pageY;
});
$("#mytext").mousedown(function() {
Element.addMethods({
resizeImg: function(element){
var element = $(element);
var img = element.down('img');
var imgDims = img.getDimensions();
var ratio = imgDims['height']/imgDims['width'];
var winDims = document.viewport.getDimensions();
if ((winDims['height']/winDims['width']) > ratio) {
winDims['width'] = Math.ceil(winDims['height'] / ratio);
} else {
//you can edit these values to change the wording of the link
var DEF_READ_MORE = 'read more...';
var DEF_HIDE = 'hide';
//don't edit below here
$$('div.disclose').invoke('hide').invoke('insert',{before:'<p><a href="#' + this.id + '" class="tog">' + DEF_READ_MORE + '</a></p>'});
document.observe('click',function(evt){
var elm;
if(elm = evt.findElement('a.tog')){
evt.stop();
var text = (elm.innerHTML == DEF_READ_MORE) ? DEF_HIDE : DEF_READ_MORE;