Trip NL
%Europe/Berlin %467 %2007, 12:12
Hallo allemaal,
Ik heb een probleem met een Popup Javascript. Dit script opent een nieuw window met daarin een afbeelding die in Flash opgehaald wordt uit een XML bestand. Het Javascript heb ik toegevoegd aan de html pagina van het Flash bestand. Alleen er gebeurd niets. De afbeelding direct openen doet hij wel.
De code:
// Vergroot functie
function enlargeImage() {
getURL(""+url[p]+"");
picture_num();
}
De XML:
<?xml version="1.0"?>
<print>
<file>
<preview>./cms/images/web_01.jpg</preview>
<omschrijving>omschrijving website 1</omschrijving>
<url>javascript:PopupPic('./cms/images/web_01_groot.jpg')</url>
</file>
<file>
<preview>./cms/images/web_02.jpg</preview>
<omschrijving>omschrijving website 2</omschrijving>
<url>./cms/images/web_02_groot.jpg</url>
</file>
</print>
2e url node werkt dus wel, maar dan krijg ik gewoon een _blank pagina met het plaatje. En dat wil ik niet.
het script in html:
<script type="text/javascript">
function PopupPic(sPicURL) {
window.open( "popup.html?"+sPicURL, "",
"resizable=0,height=100,width=100");
}
</script>
popup.html:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Showcase Portfolio Multimedia Vormgever Lieve Sonke</title>
<script type="text/javascript">
var arrTemp=self.location.href.split("?");
var picUrl = (arrTemp.length>0)?arrTemp[1]:"";
var NS = (navigator.appName=="Netscape")?true:false;
function FitPic() {
iWidth = (NS)?window.innerWidth:document.body.clientWidth;
iHeight = (NS)?window.innerHeight:document.body.clientHeight ;
iWidth = document.images[0].width - iWidth;
iHeight = document.images[0].height - iHeight;
window.resizeBy(iWidth, iHeight);
self.focus();
};
</script>
<style type="text/css">
body {
background-color:#000000;
margin: 0;
padding: 0;
}
</style>
</head>
<body onload='FitPic();'>
<script type="text/javascript">
document.write( "<img src='" + picUrl + "' border=0>" );
</script>
</body>
</html>
En om te laten zien dat er geen fout in het script zit: http://www.id83.nl/tmp/jstest
Wat doe ik fout?
Ik heb een probleem met een Popup Javascript. Dit script opent een nieuw window met daarin een afbeelding die in Flash opgehaald wordt uit een XML bestand. Het Javascript heb ik toegevoegd aan de html pagina van het Flash bestand. Alleen er gebeurd niets. De afbeelding direct openen doet hij wel.
De code:
// Vergroot functie
function enlargeImage() {
getURL(""+url[p]+"");
picture_num();
}
De XML:
<?xml version="1.0"?>
<print>
<file>
<preview>./cms/images/web_01.jpg</preview>
<omschrijving>omschrijving website 1</omschrijving>
<url>javascript:PopupPic('./cms/images/web_01_groot.jpg')</url>
</file>
<file>
<preview>./cms/images/web_02.jpg</preview>
<omschrijving>omschrijving website 2</omschrijving>
<url>./cms/images/web_02_groot.jpg</url>
</file>
</print>
2e url node werkt dus wel, maar dan krijg ik gewoon een _blank pagina met het plaatje. En dat wil ik niet.
het script in html:
<script type="text/javascript">
function PopupPic(sPicURL) {
window.open( "popup.html?"+sPicURL, "",
"resizable=0,height=100,width=100");
}
</script>
popup.html:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Showcase Portfolio Multimedia Vormgever Lieve Sonke</title>
<script type="text/javascript">
var arrTemp=self.location.href.split("?");
var picUrl = (arrTemp.length>0)?arrTemp[1]:"";
var NS = (navigator.appName=="Netscape")?true:false;
function FitPic() {
iWidth = (NS)?window.innerWidth:document.body.clientWidth;
iHeight = (NS)?window.innerHeight:document.body.clientHeight ;
iWidth = document.images[0].width - iWidth;
iHeight = document.images[0].height - iHeight;
window.resizeBy(iWidth, iHeight);
self.focus();
};
</script>
<style type="text/css">
body {
background-color:#000000;
margin: 0;
padding: 0;
}
</style>
</head>
<body onload='FitPic();'>
<script type="text/javascript">
document.write( "<img src='" + picUrl + "' border=0>" );
</script>
</body>
</html>
En om te laten zien dat er geen fout in het script zit: http://www.id83.nl/tmp/jstest
Wat doe ik fout?