/    Sign up×
Community /Pin to ProfileBookmark

Problem with popup

Hello everyone!!It’s my first thread ?
Please,could anyone help me?I’m going crazy…
I’ve made a HTML page: I have one small picture in it and I’d like opening it (after clicking on it) in a popup whose size is the one of the picture.
I’ve found the following JavaScript: the problem is that it perfectly works in local (before uploading my page to my remote server) and the popup opens regularly. When I upload my page to my remote server, the popup doesn’t open!!! I really can’t find the reason!!! ?
Thanks to all the people who will be so kind as to help me…
Bye!!

PS: I use Dreamweaver MX

I’ve put between the <head> the following:

<script language=”JavaScript”>
<!–

function SymError()
{
return true;
}

window.onerror = SymError;

var SymRealWinOpen = window.open;

function SymWinOpen(url, name, attributes)
{
return (new Object());
}

window.open = SymWinOpen;

//–>
</script>

<SCRIPT LANGUAGE=”JavaScript1.2″>
var finestra;
var undef;
var x0,y0,titolo;
function popup(wid,hei,immagine,titolo) {
if (typeof finestra != “undefined”) finestra.close();
x0 = Math.floor((screen.width – wid) / 2);
y0 = Math.floor((screen.height – hei) / 2);
finestra = window.open(“”,””,”width=” + wid + ” ,height=” + hei +
” ,left=” + x0 + “,top=” + y0);
finestra.document.write(“<IMG SRC=” + immagine + ” WIDTH=” + wid + ” HEIGHT=” +
hei + ” BORDER=’0′ STYLE=’position:absolute; left:0px; top:0px’>”);
finestra.document.title = titolo;
}
function chiudi() {
if (typeof finestra != “undefined”) {
finestra.close();
finestra = undef;
}
}
</SCRIPT>

Then, I’ve put this code inside the body of my HTML page:

<A HREF=”javascript:” onClick=”popup(400,300,’bigpicture.jpg’,’Titolo’)”><img src=”smallpicture.jpg” alt=”” width=”40″ height=”30″ border=”0″></A>

At the end,after closing the body:

<script language=”JavaScript”>
<!–

window.open = SymRealWinOpen;

//–>
</script>

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@ShrineDesignsDec 13.2002 — this fixes you "popup" function

<html>

<head>

<script language="JavaScript">

<!--

function SymError(){

window.onError = "SymError";

}

function SymWinOpen(url,name,attributes){

window.open(url,name,attributes);

}

function popup(url,winName,W,H){

x = Math.floor((screen.width - W) / 2);

y = Math.floor((screen.height - H) / 2);

fineStr = window.open(url,winName,'width=' + W + '','height=' + H + '','left=' + x + '','top=' + y + ''); // document.write will override the url

fineStr.document.write('<html>n<head>n<title>' + winName + '</title>n</head>n<body style="margin:0px;">n<IMG SRC="' + url + '" WIDTH="' + W + '" HEIGHT="' + H + '" BORDER="0" STYLE="position:absolute; left:0px; top:0px">n</body>n</html>n');

}

var undef = "";

function chiudi(){

if (typeof finestra != "undefined"){

fineStr.close();

fineStr = undef;

}

}

//-->

</script>

</head>

<body onLoad="SymWinOpen('myDocument.html','myWindow','height=200 width=200')">

<A HREF="javascript:void(0);" onClick="popup('bigpicture.jpg','Titolo',400,300)"><img src="smallpicture.jpg" alt="" width="40" height="30" border="0"></A>

</body>

</html>

i have no idea what your other functions do but "SymRealWinOpen" is not properly coded
Copy linkTweet thisAlerts:
@giorgioauthorDec 13.2002 — Thank you!!
×

Success!

Help @giorgio spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.29,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...