PDA

View Full Version : :: what am i doing wrong here? ::


babelfish
08-13-2002, 03:46 PM
arghhhh finally started to understand jscript then i take a weeks holiday, smoke and drink too much and then forget some basics



<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>popuphelper</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script language="JavaScript" type="text/JavaScript">
<!--
function displayWindow(theURL,winName,width,height,features) { //v3.1
// Made by Eddie Traversa modified from Macromedia Code
// http://nirvana.media3.net/
var window_width = width;
var window_height = height;
var newfeatures= features;
var window_top = (screen.height-window_height)/2;
var window_left = (screen.width-window_width)/2;
newWindow=window.open(''+ theURL + '',''+ winName + '','width=' + window_width + ',height=' + window_height + ',top=' + window_top + ',left=' + window_left + ',features=' + newfeatures + '');
newWindow.focus();
}


function popuphelper(page) {
var popupurl = 'http://www.simonsgroup.com/webimg/popuphelpers/' + page + '.html';
displayWindow('+ popupurl +','popuphelp','260','200','scrollbars=yes,resizable=yes');
popuphelp.focus();
}

//-->
</script>
</head>

<body>
<a href="javascript:;"
onClick="popuphelper('search')"
onMouseOver="document.helpicon.src='http://www.simonsgroup.com/webimg/navimg/helpicon1.gif'"
onMouseOut="document.helpicon.src='http://www.simonsgroup.com/webimg/navimg/helpicon.gif'"
>
<img src="http://www.simonsgroup.com/webimg/navimg/helpicon.gif" alt="Click for page help" name="helpicon" height="18" border="0">
</a>
</body>
</html>



why doesnt the popup display the correct page?

thanks!!!!!!

beetle
08-13-2002, 04:01 PM
function popuphelper(page) {
var popupurl = 'http://www.simonsgroup.com/webimg/popuphelpers/' + page + '.html';
displayWindow('+ popupurl +' ,'popuphelp','260','200','scrollbars=yes,resizable=yes');
popuphelp.focus();
}
Why the string concatenation? (which isn't even formatted properly, you are actually sending the string "+ popurl +") Just send the variable...function popuphelper(page) {
var popupurl = 'http://www.simonsgroup.com/webimg/popuphelpers/' + page + '.html';
displayWindow(popupurl ,'popuphelp','260','200','scrollbars=yes,resizable=yes');
popuphelp.focus();
}

babelfish
08-13-2002, 04:06 PM
:) thx m8 - as i say im pretty lame at this - so thanks :)

babelfish
08-13-2002, 04:55 PM
ARGHHHHHHHHHHHH any idea why the scrollbar doesnt work?

beetle
08-13-2002, 05:14 PM
This line is all wrong. Too much string concatenation like before (and improperly formatted)newWindow=window.open(''+ theURL + '',''+ winName + '','width=' + window_width + ',height=' + window_height + ',top=' + window_top + ',left=' + window_left + ',features=' + newfeatures + '');
Change it up like thisnewWindow=window.open(theURL, winName ,'width=' + window_width + ',height=' + window_height + ',top=' + window_top + ',left=' + window_left + ',' + newfeatures);

babelfish
08-13-2002, 05:17 PM
thanks again!!!!!!1 :thumbsup: