javascript question - onclick
I am trying to get this code to work, but it keeps failing. try this link.. http://tinyurl.com/ye5khug enter Edmonton, click on icon, then on "web site".
<script>
function newPop(url, myWin, width, height, left, top, scrollbars) {
parms = 'toolbar=yes, scrollbars=no, location=no, menubar=no, resizable=no, width= ' + width + ' , height=' + height + ' , left= ' + left + ' , top= ' + top + ' , titlebar=no , scrollbars = ' + scrollbars ;
var newwin = window.open(url,myWin, parms);
newwin.resizeTo(width,height);
newwin.moveTo(0,0);
newwin.moveTo(left,top);
newwin.focus();
return false;
}
</script>
<a onclick=" return newPop('http://google.co开发者_StackOverflow社区m','window', '800','800','100','0','yes')" href="#">Web Site</a>
You need to remove all of the white-space from the parms string.
e.g. :
parms = 'toolbar=yes,scrollbars=no,location=no,menubar=no,resizable=no,width=' + width + ',height=' + height + ',left=' + left + ',top=' + top + ',titlebar=no,scrollbars=' + scrollbars;
From the MDC:
This string parameter must not contain any blank space. Each requested window feature must be separated by a comma inside the character string.
problem was function was not in scope.
精彩评论