This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ---------------------------------------------------------- | |
// A short snippet for detecting versions of IE in JavaScript | |
// without resorting to user-agent sniffing | |
// ---------------------------------------------------------- | |
// If you're not in IE (or IE version is less than 5) then: | |
// ie === undefined | |
// If you're in IE (>=5) then you can determine which version: | |
// ie === 7; // IE7 | |
// Thus, to detect IE: | |
// if (ie) {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(document).ready(function() { | |
$.fn.setCursorPosition = function(pos) { | |
if ($(this).get(0).setSelectionRange) { | |
$(this).get(0).setSelectionRange(pos, pos); | |
} else if ($(this).get(0).createTextRange) { | |
var range = $(this).get(0).createTextRange(); | |
range.collapse(true); | |
range.moveEnd('character', pos); | |
range.moveStart('character', pos); | |
range.select(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function dropdown_menu() { | |
$("#sub-menu-id a, .subnav a"); | |
$(" #sub-menu-id ").css({ | |
display: "none", | |
opacity: "1" | |
}); // fix for opera browser | |
$("#sub-menu-id li").each(function() { | |
var $subNav = jQuery(this).find('ul:first'); | |
$(this).hover(function() { | |
$subNav.stop().css({ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function dropdown_menu() { | |
$("#sub-menu-id a, .subnav a"); | |
$(" #sub-menu-id ").css({ | |
display: "none", | |
opacity: "1" | |
}); // fix for opera browser | |
$("#sub-menu-id li").each(function() { | |
var $subNav = jQuery(this).find('ul:first'); | |
$(this).hover(function() { | |
$subNav.stop().css({ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- jQuery Code --> | |
$(document).ready(function() { | |
$('#commentbox').hide(); | |
$('a.comment').click(function() { | |
var id = $(this).attr('id'); | |
$('#commentbox' + id).toggle(500); | |
// alert(id); | |
return false; | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
reply |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(document).ready(function() { | |
$('div.chapter a[@href*=wikipedia]').each(function(index) { | |
var $thisLink = $(this); | |
$thisLink.attr({ | |
'rel': 'external', | |
'id': 'wikilink-' + index, | |
'title': 'learn more about ' + $thisLink.text() + ' at Wikipedia' | |
}); }); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
header(‘Expires: Mon, 1 Jul 1998 01:00:00 GMT’); | |
header(‘Cache-Control: no-store, no-cache, must-revalidate’); | |
header(‘Cache-Control: post-check=0, pre-check=0′, FALSE); | |
header(‘Pragma: no-cache’); | |
header( “Last-Modified: ” . gmdate( “D, j M Y H:i:s” ) . ” GMT” ); | |
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* @param mysql_resource - $queryResult - mysql query result | |
* @param string - $rootElementName - root element name | |
* @param string - $childElementName - child element name | |
*/ | |
function sqlToXml($queryResult, $rootElementName, $childElementName) | |
{ | |
$xmlData = "<?xml version=\"1.0\" encoding=\"ISO-8859-1\" ?>\n"; | |
$xmlData .= "<" . $rootElementName . ">"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
if(typeof jQuery=='undefined') { | |
function getScript(url,success) { | |
var script=document.createElement('script'); | |
script.src=url; | |
var head=document.getElementsByTagName('head')[0],done=false;script.onload=script.onreadystatechange=function() { | |
if(!done&&(!this.readyState||this.readyState=='loaded'||this.readyState=='complete')){done=true;success(); | |
script.onload=script.onreadystatechange=null;head.removeChild(script)}};head.appendChild(script)};getScript('http://ajax.googleapis.com/ajax/libs/jquery/1.6.0/jquery.min.js',function() { | |
if(typeof jQuery=='undefined'){}else{fancyCode()}})}else{fancyCode()} | |
function fancyCode(){ var code = '<!DOCTYPE html>\n<html>\n' + $("html").html().replace(/[<>]/g, function(m){return{'<':'<','>':'>'}[m]}).replace(/((ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?)/gi,'<a href="$1">$1</a>'); |
OlderNewer