PDA

View Full Version : javascript for showOpenDialog


Xeon-YK
06-23-2006, 12:56 PM
i want to ask can we make OpenDialog window with javascript??

can you give me the code or link for showOpenDialog window

thx

Kravvitz
06-26-2006, 06:48 PM
You might be able to do this in IE, but you can't in other browsers.

Jon Hanlon
06-27-2006, 09:31 PM
showOpenDialog is java, not javascript.

_Aerospace_Eng_
06-27-2006, 09:49 PM
I believe the OP wants showModalDialog. Since it is IE only you should check that the function exists before you try to run it.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>showModelDialog</title>
<script type="text/javascript">
function loadit(url,wid,hgt)
{
var sw = (screen.width - wid) / 2;
var sh = (screen.height - hgt) / 2;
if (window.showModalDialog)
{
win = window.showModalDialog(url,'dialogHeight='+hgt+',dialogWidth='+wid+'');
}
else
{
win = window.open(url,'win','height='+hgt+',width='+wid+',top='+sh+',left='+sw+'');
}
}
</script>
</head>

<body>
<a href="http://www.yahoo.com" onclick="loadit(this.href,400,400);return false">yahoo</a>
</body>
</html>
That will use showModalDialog for IE and window.open for other browsers.