Opera and Firefox both run the following function perfectly as expected but IE7 opens a new whole page window and complains about ActiveX, requiring an acceptance by the user before the 'Close Window' button will work. Any suggestions gratefully accepted.

function popup(mylink, windowname, w, h)
{
if (! window.focus)return true;
var href;
if (typeof(mylink) == 'string')
   href=mylink;
else
   href=mylink.href;
   settings="width=" + w + ",height=" + h + ",scrollbars=yes,location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no";
window.open(href, windowname, settings);
return false;
}

A sample call to the function would be:-

<span class="link2"><a href="070595.html" target="_blank" onClick="return popup(this, 'Item 070595', '400', '420')">Larger Image...</a> </span>

Recommended Answers

All 8 Replies

are you running this locally on your computer or via a website ?

if its locally you will recieve this error through IE to disable it. Set your security settings to low/intranet in IE.

Maybe this would help!

<html>
<head>
<title><!--Sample--></title>
</head>
<body>
<span class="link2">
<a href="javascript:void(0);"  onclick=" window.open('070595.html', 'Item 070595', 'toolbar=no,scrollbars=yes,location=no,directories=no,status=no,resizable=no,width=400,height=420');">Larger Image...</a> 
</span>
</html>

Via website - it's part of a whole html page.

Maybe this would help!

<html>
<head>
<title><!--Sample--></title>
</head>
<body>
<span class="link2">
<a href="javascript:void(0);"  onclick=" window.open('070595.html', 'Item 070595', 'toolbar=no,scrollbars=yes,location=no,directories=no,status=no,resizable=no,width=400,height=420');">Larger Image...</a> 
</span>
</html>

Thanks for that - I'll give it a try. However, I was hoping to use a function so I could pass the size parameters for each popup without having to write the whole thing each time. There are up to 12 popups on some pages.

Maybe this would help!

<html>
<head>
<title><!--Sample--></title>
</head>
<body>
<span class="link2">
<a href="javascript:void(0);"  onclick=" window.open('070595.html', 'Item 070595', 'toolbar=no,scrollbars=yes,location=no,directories=no,status=no,resizable=no,width=400,height=420');">Larger Image...</a> 
</span>
</html>

Sorry, that doesn't seem to work at all.

You must be having some technical issue, i guess! And that code is actually workin fine with me...
Ok let's head to my last result!
If this doesnt solve the issue then i would like to say sorry in advanced...
Good Day to you!

<html>
<head>
<title><!-- Sample --></title>
<script type="text/javascript">
<!--
function openWindow( thisLink, thisTitle )
{ window.open(thisLink, target='_blank', thisTitle, 'toolbar = no, menubar = no, scrollbars = yes, location = no, directories = no, status = no, resizable = no, width = 400,height = 420');
}

window.onload = function()
{ var a = document.getElementsByTagName('a');
  for ( var x = 0; x <= a.length; x++ ) {
 if ( a.addEventListener ) 
{ a.addEventListener('click', openWindow(a[x].href, a[x].title), false ) }
 else if ( a.attachEvent ) {
  a[x].attachEvent('onclick', openWindow(a[x].href, a[x].title); }
 else { return false; }
 }
}
//-->
</script>
</head>
<body>
<a href="070595.html" alt="" title="Item 070595">Link1</a><br />
<a href="YourPage2.html" alt="" title="Link2">Link2</a><br />
<a href="YourPage3.html" alt="" title="Link3">Link3</a><br />
<a href="YourPage4.html" alt="" title="Link4">Link4</a>
</body>
</html>

You must be having some technical issue, i guess! And that code is actually workin fine with me...
Ok let's head to my last result!
If this doesnt solve the issue then i would like to say sorry in advanced...
Good Day to you!

<html>
<head>
<title><!-- Sample --></title>
<script type="text/javascript">
<!--
function openWindow( thisLink, thisTitle )
{ window.open(thisLink, target='_blank', thisTitle, 'toolbar = no, menubar = no, scrollbars = yes, location = no, directories = no, status = no, resizable = no, width = 400,height = 420');
}

window.onload = function()
{ var a = document.getElementsByTagName('a');
  for ( var x = 0; x <= a.length; x++ ) {
 if ( a.addEventListener ) 
{ a.addEventListener('click', openWindow(a[x].href, a[x].title), false ) }
 else if ( a.attachEvent ) {
  a[x].attachEvent('onclick', openWindow(a[x].href, a[x].title); }
 else { return false; }
 }
}
//-->
</script>
</head>
<body>
<a href="070595.html" alt="" title="Item 070595">Link1</a><br />
<a href="YourPage2.html" alt="" title="Link2">Link2</a><br />
<a href="YourPage3.html" alt="" title="Link3">Link3</a><br />
<a href="YourPage4.html" alt="" title="Link4">Link4</a>
</body>
</html>

You must be having some technical issue, i guess! And that code is actually workin fine with me...
Ok let's head to my last result!
If this doesnt solve the issue then i would like to say sorry in advanced...
Good Day to you!

<html>
<head>
<title><!-- Sample --></title>
<script type="text/javascript">
<!--
function openWindow( thisLink, thisTitle )
{ window.open(thisLink, target='_blank', thisTitle, 'toolbar = no, menubar = no, scrollbars = yes, location = no, directories = no, status = no, resizable = no, width = 400,height = 420');
}

window.onload = function()
{ var a = document.getElementsByTagName('a');
  for ( var x = 0; x <= a.length; x++ ) {
 if ( a.addEventListener ) 
{ a.addEventListener('click', openWindow(a[x].href, a[x].title), false ) }
 else if ( a.attachEvent ) {
  a[x].attachEvent('onclick', openWindow(a[x].href, a[x].title); }
 else { return false; }
 }
}
//-->
</script>
</head>
<body>
<a href="070595.html" alt="" title="Item 070595">Link1</a><br />
<a href="YourPage2.html" alt="" title="Link2">Link2</a><br />
<a href="YourPage3.html" alt="" title="Link3">Link3</a><br />
<a href="YourPage4.html" alt="" title="Link4">Link4</a>
</body>
</html>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.