Jineeshjohn’s Blog

Here I would like to show a how to create a overlay for the parent window using jQuery.

 Parent window code 

// your jquery js path


/* A unique name for the window. 
    Used when ever dealing with multiple pop - up windows */
var wn = new Date().valueOf(); 
function disableParent(){
	var e = $("div.overlay");
	var p = $("body");
	e.height(p.height()).width(p.width()).show();
	
}
function enableParent(){
 	var e = $("div.overlay",opener.document).css("display","none");
	window.close();
}



	div.overlay{
		background-color:#666;
		position:absolute;
		display:none;
		z-index:10;
		height:800px;
		width:1000px;
		filter: alpha(opacity=50);
		opacity: 0.5;
	}



Hi,

Here i would like to show how to write a basic bubble sort using JavaScript.

 

function bubbleSort( arr ){
	var i = arr.length - 1, j;
	for (i ; i >= 0; i--){
		for (j = 0; j <= i; j++){
			if (arr[j+1] < arr[j]) {
				var temp = arr[j];
				arr[j] = arr[j+1];
				arr[j+1] = temp;
			}
		}
	}
	return arr;
}

 

This function can be used for returning xml document by passing a xml String

function xmlDataLoader(xmlData) {
	if ( window.ActiveXObject ) {
		xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
		xmlDoc.async="false";
		xmlDoc.loadXML(xmlData);
		return xmlDoc; 
	}else if ( document.implementation && document.implementation.createDocument ) {
		parser=new DOMParser();
		xmlDoc=parser.parseFromString(xmlData,"text/xml");
		return xmlDoc;
	}
	return xmlObject;
}


  • None
  • No comments yet

Categories