New Technologies

  • Java
  • Javascript
  • DTML
  • Dot Net
  • ASP .Net
  • C# .Net
  • PHP
Your Ad Here

Tuesday, March 18, 2008

How to over Popup windows

<script language="javascript">

//set object to hold windows

var oWindowsT = new Object();



function openWindowCheck(pageId) {

//open window

openWin(pageId);



//check if the window opened

setTimeout("checkOpen(\"" + pageId+ "\")",1000);

}





function checkOpen(pageId) {

try {

if ( (!oWindowsT[pageId]) || (oWindowsT[pageId].closed) ) {

//handle code how ever you want

var elem = window.document.getElementById("popupmsg");

elem.style.visibility = "visible";

} else {

var elem = window.document.getElementById("popupmsg");

elem.style.visibility = "hidden";

}

}catch(e){

//if unable to read var show message

}

}



function closeIt() {

window.document.getElementById("popupmsg").style.visibility = "hidden";

}

//open a window

function openWin(pageId) {

switch (pageId) {

case "page1":

//set window properties

var sPar = "width=500,height=500";

handle = window.open("http://rachasatish.blogspot.com/",pageId,sPar);

break;

case "page2":

//add code for another id

//handle = window.open(sURL,page,sPar);

break;

default:

}

//add handle to window object holder

oWindowsT[pageId] = handle;

}



</script>


<body onload="openWindowCheck('page1');" style="margin:0">

<style>

#msg{

background-color:#ccffff;

height:200;

width:200;

font-family:verdana

}

</style>

<div id="popupmsg" style="visibility:hidden;text-align:center;">

<div id="msg" style="">

^<br />

^<br />

^<br />

^<br />

It appears you have your popup blocker turned on for this site.

<br />

<a href="javascript:closeIt()">close</a>

</div>


</body>

Saturday, March 8, 2008

Code to Get All the Headers in Java

Enumeration enum1 = request.getHeaderNames();

String name = "user-agent";

String value = request.getHeader(name);

if (value == null) {

// The request header was not present

}

for (; enum1.hasMoreElements(); ) {

// Get the name of the request header

name = (String)enum1.nextElement();

out.println(name);


// Get a value of the request header

value = request.getHeader(name);


// If the request header can appear more than once, get all values

Enumeration valuesEnum = request.getHeaders(name);

for (; valuesEnum.hasMoreElements(); ) {

// Get a value of the request header

value = (String)valuesEnum.nextElement();


out.println(value+"
");

}

}
Your Ad Here