Skip to content

Instantly share code, notes, and snippets.

function truncateString($str, $max, $rep = '...') {
if(strlen($str) > $max) {
$leave = $max - strlen($rep);
return substr_replace($str, $rep, $leave);
} else {
return $str;
}
}
list($width, $height) = getimagesize($img);
if($_SERVER["REQUEST_METHOD"] == "POST") {
if(window.attachEvent) {
window.attachEvent('onload', yourFunctionName);
} else {
if(window.onload) {
var curronload = window.onload;
var newonload = function() {
curronload();
yourFunctionName();
};
window.onload = newonload;
setTimeout(function(){myFunction(parameter); parameter = null},myTimeout);
<!-- Script by hscripts.com -->
<!-- copyright of HIOX INDIA -->
<!-- Free javascripts @ http://www.hscripts.com -->
<script type="text/javascript">
checked=false;
function checkedAll (frm1) {
var aa= document.getElementById('frm1');
if (checked == false)
{
checked = true
/* This script and many more are available free online at
The JavaScript Source!! http://javascript.internet.com
Created by: Greg Burghardt | http://www.geocities.com/greg_burghardt/ */
var _GET = {};
function readURL() {
var tLoc = "", tPairs = "";
var tGet = [];
var foundGet = -1;
tLoc = window.location + "";
function IsEmpty(aTextField) {
if ((aTextField.value.length==0) ||
(aTextField.value==null)) {
return true;
}
else { return false; }
}
@QuestionDevelopment
QuestionDevelopment / confirm exit
Created August 23, 2013 20:00
not so good...can't refresh page
window.onbeforeunload = confirmExit;
function confirmExit() {
//return "To save your portfolio, click Cancel and then click the SAVE button.\n\nTo leave the page without saving your portfolio, click OK.";
}
<? } ?>