PDA

View Full Version : javascript that doesn't set off explorer activex control


linda838
06-21-2006, 12:19 PM
hi guys,

this is my first time posting. i'm pretty much a beginnner. i've been trying to use javascript to generate a new window with the dimensions i want. but i've been frustrated because it always sets off my own explorer's activex control when i test my site. i am then afraid to use the code because i don't want other people viewing my site to be deterred by this warning. i see other sites with a similar simple javascript code to mine that work and i don't know what i'm doing wrong. i would appreciate some help! what am i missing?

my javascript code, inserted between my <header></header> tags:

<script language="javascript" type="text/javascript">
<!--

function newWindow(url)
{
var w = window.open(url,"","width=760,toolbar=no,directories=no,status=no,scrollbars=yes,resize=yes,menubar=yes,history=no");
w.window.focus();
}

// -->
</script>

then i use the function in the body of my page via the following (copied the line in my code):

<div class="thumb"><a href="javascript:newwindow('oil1.html');"><img alt="Julie" src="images/thumb_o1.jpg" /></a></div>

i am testing this in windows explorer 6.0

thanks in advance for your help..
-linda

_Aerospace_Eng_
06-21-2006, 12:51 PM
Let me guess. You are testing locally? When you upload the file to a web server the warning should go away. For accessibility reasons you should really be using the script like so
<div class="thumb"><a href="oil1.html" onclick="newwindow(this.href);return false" target="_blank"><img alt="Julie" src="images/thumb_o1.jpg" /></a></div>
this way the user still gets the page even with JS disabled rather than just a dead link.

coothead
06-21-2006, 01:11 PM
Hi there linda838,

if you wish to get rid of the warning locally, then you have two options...

1. place this comment directly below the DOCTYPE
<!-- saved from url=(0017)http://mysite.com -->
2. open IE then

    click 'tools' > 'Internet Options' > 'Advanced' tab > scroll down to 'Secuity' > check 'Allow active content to run on My Computer' > Apply > OK

linda838
06-26-2006, 06:10 PM
thanks guys. your response was really useful and ended a couple days of sheer frustration. uploaded it to my site and the warning went away *doh* i would have replied sooner but coding got in the way. :) but i'm really glad i found this forum - thanks for responding so quickly!

now i am getting a little more ambitious and testing a piece of javascript that would allow me to generate a new page using the document.write command... i'm sure i will have loads more questions about that.

cheers,
linda.