Remove element from div Javascript

<div id="image_holder_on">
<img id="on_image" src="command.src" style="visibility:hidden;"/>
<script>
var d_on = document.getElementById('image_holder_on');
var on_image = document.getElementById('on_image');
d_on.removeChild(on_image);
</script>
</div>

Posted on 14 Dec 2009, 15:15 - Category: JavaScript
Comments - Edit - Delete


JavaScript expando sections scriptaculous

/* Expando sections functions */
function accordian(to_show_or_hide, to_toggle)
{
if(accordianing == true)
{
setTimeout( function() { accordian(to_show_or_hide, to_toggle); }, 25);
}
else
{
accordianing = true;
toggle_arrow_noscroll(to_toggle);
if($(to_show_or_hide).style.display == 'none')
{
new Effect.BlindDown(to_show_or_hide, {
duration: 0.5,
afterFinish: function(){ accordianing = false; }
});
}
else
{
new Effect.BlindUp(to_show_or_hide, {
duration: 0.5,
afterFinish: function(){ accordianing = false; }
});
}
cart_y_max = getDocHeight();
}
}

function toggle_arrow_noscroll(id_sent)
{
this_current_image = ($(id_sent).src).search(/close/);
if(this_current_image == -1)
{
$(id_sent).src = 'images/arrow-close.gif';
}
else
{
$(id_sent).src = 'images/arrow-expand.gif';
}
}

Posted on 12 Nov 2009, 16:17 - Category: JavaScript
Comments - Edit - Delete


Javascript script.aculo.us rollover menu accordian show hide style

/* right nav menu functions (toggle_accordian) */

/* onload clear */

setTimeout( function() { accordianing = false; }, 4000);

//Effect.Queues.get('menuxscope').interval = 10;

accordianing = true;

function toggle_accordian(to_show_or_hide)
{
if(accordianing == true)
{
setTimeout( function() { toggle_accordian(to_show_or_hide); }, 25);
}
else
{
if($(to_show_or_hide).style.display == 'none')
{
new Effect.BlindDown(to_show_or_hide, {
duration: 0.25,
queue: 'end',
afterFinish: function() { slide_up_open(to_show_or_hide); }
});
//reset_menu_colors();
}
else
{
new Effect.BlindUp(to_show_or_hide, {
duration: 0.25,
queue: 'end',
afterFinish: function() { accordianing = false; }
});
}
}
}

function slide_up_open(to_show_or_hide)
{
reset_menu_colors();
switch(to_show_or_hide)
{
case 'sub_category_0':
var clean_order = new Array('sub_category_1', 'sub_category_2', 'sub_category_3', 'sub_category_4', 'sub_category_5'); var C = setTimeout( function() { cleanup(clean_order); }, 10); break;
case 'sub_category_1': var clean_order = new Array('sub_category_2', 'sub_category_3', 'sub_category_4', 'sub_category_5'); var C = setTimeout( function() { cleanup(clean_order); }, 10); break;
case 'sub_category_2': var clean_order = new Array('sub_category_1', 'sub_category_3', 'sub_category_4', 'sub_category_5'); var C = setTimeout( function() { cleanup(clean_order); }, 10); break;
case 'sub_category_3': var clean_order = new Array('sub_category_1', 'sub_category_2', 'sub_category_4', 'sub_category_5'); var C = setTimeout( function() { cleanup(clean_order); }, 10); break;
case 'sub_category_4': var clean_order = new Array('sub_category_1', 'sub_category_2', 'sub_category_3', 'sub_category_5'); var C = setTimeout( function() { cleanup(clean_order); }, 10); break;
case 'sub_category_5': var clean_order = new Array('sub_category_1', 'sub_category_2', 'sub_category_3', 'sub_category_4'); var C = setTimeout( function() { cleanup(clean_order); }, 10); break;
}
}

function cleanup(clean_order_passed)
{
for( i = 0; i <= clean_order_passed.length; i++ )
{
if($(clean_order_passed[i]) == null)
{
accordianing = false;
}
else
{
new Effect.BlindUp(clean_order_passed[i], {
duration: 0.25,
queue: 'end'
});
}
}
accordianing = false;
}

/* menu bold management */
function rollover_color(which)
{
from_color = $(which).style.color;
$(which).style.color = '#5C855C';
}

function rollback_color(which)
{
$(which).style.color = from_color;
reset_menu_colors();
}

function reset_menu_colors()
{
for (p = 2; p <= 35; p++)
{
var counterer = "link_" + p;
if((counterer == category)||(counterer == category2))
{
//$(counterer).style.color = "#5c855c";
$(counterer).style.fontWeight = "bold";
}
else
{
//document.getElementById(counterer).style.color = "#214236";
document.getElementById(counterer).style.fontWeight = "normal";
}
}
}

Posted on 23 Oct 2009, 11:07 - Category: JavaScript
Comments - Edit - Delete


JavaScript Lightwindow activate

onclick="myLightWindow.activateWindow({ href: 'pages/full_description.php', width: 800, height: 500, type: 'page' }); return false;"

Posted on 7 Oct 2009, 16:49 - Category: JavaScript
Comments - Edit - Delete


JavaScript Browser detect function

/* BROWSER DETECT */
var BrowserDetect = {
init: function () {
this.browser = this.searchString(this.dataBrowser) || "An unknown browser";
this.version = this.searchVersion(navigator.userAgent)
|| this.searchVersion(navigator.appVersion)
|| "an unknown version";
this.OS = this.searchString(this.dataOS) || "an unknown OS";
},
searchString: function (data) {
for (var i=0;i<data.length;i++) {
var dataString = data[i].string;
var dataProp = data[i].prop;
this.versionSearchString = data[i].versionSearch || data[i].identity;
if (dataString) {
if (dataString.indexOf(data[i].subString) != -1)
return data[i].identity;
}
else if (dataProp)
return data[i].identity;
}
},
searchVersion: function (dataString) {
var index = dataString.indexOf(this.versionSearchString);
if (index == -1) return;
return parseFloat(dataString.substring(index+this.versionSearchString.length+1));
},
dataBrowser: [
{
//This doesn't work. Chrome not returning "Chrome" something to look into...
string: navigator.userAgent,
subString: "Chrome",
identity: "Chrome"
},
{ string: navigator.userAgent,
subString: "OmniWeb",
versionSearch: "OmniWeb/",
identity: "OmniWeb"
},
{
string: navigator.vendor,
subString: "Apple",
identity: "Safari",
versionSearch: "Version"
},
{
prop: window.opera,
identity: "Opera"
},
{
string: navigator.vendor,
subString: "iCab",
identity: "iCab"
},
{
string: navigator.vendor,
subString: "KDE",
identity: "Konqueror"
},
{
string: navigator.userAgent,
subString: "Firefox",
identity: "Firefox"
},
{
string: navigator.vendor,
subString: "Camino",
identity: "Camino"
},
{ // for newer Netscapes (6+)
string: navigator.userAgent,
subString: "Netscape",
identity: "Netscape"
},
{
string: navigator.userAgent,
subString: "MSIE",
identity: "Explorer",
versionSearch: "MSIE"
},
{
string: navigator.userAgent,
subString: "Gecko",
identity: "Mozilla",
versionSearch: "rv"
},
{ // for older Netscapes (4-)
string: navigator.userAgent,
subString: "Mozilla",
identity: "Netscape",
versionSearch: "Mozilla"
}
],
dataOS : [
{
string: navigator.platform,
subString: "Win",
identity: "Windows"
},
{
string: navigator.platform,
subString: "Mac",
identity: "Mac"
},
{
string: navigator.userAgent,
subString: "iPhone",
identity: "iPhone/iPod"
},
{
string: navigator.platform,
subString: "Linux",
identity: "Linux"
}
]

};
BrowserDetect.init();

//Default set
browser_in_use = "default";
firefox = ", type: 'page'";
image_loc = "images/";
cart_x_min = -750;
cart_x_max = 500;
cart_x_start = 250;

cart_y_min = 25;
cart_y_max = 1750;
cart_y_start = 30;
/*
if((BrowserDetect.browser == "Firefox") || (BrowserDetect.browser == "Safari"))
{
browser_in_use = "FF";
firefox = ", type: 'page'";
image_loc = "images/";
cart_x_min = -630;
cart_x_max = 400;
cart_x_start = 250;
cart_y_max = -400;
cart_y_min = -1375;
cart_y_start = -900;
}
*/
if(BrowserDetect.browser == "Explorer")
{
browser_in_use = "IE";
}


Posted on 28 Sep 2009, 12:31 - Category: JavaScript
Comments - Edit - Delete


Pages: [1] [2] [3]
Loading