Click to See Complete Forum and Search --> : Still a Newbie-- have another easy Window sizing question


clankid
06-12-2003, 11:37 AM
I have this code:

<script language="javascript">
function openref(ref)
{
a = window.open(ref,'refpic','status=no, location=no, scrollbars=yes, resizable=no, width=600, height=475, top=40, left=40, toolbar=no');
return
}
</script>

I am using this script to open a new, specifically sized window when a link is clicked.

I am obviously missing the link info. My question is: what should that link reference look like? I was a dumb person when I updated my page and took out my link thinking my script would be unharmed. But, voila! My link reference is of course gone and I have no idea what it looked like.

Thanks for advice and patience.

Amber

Greelmo
06-12-2003, 11:48 AM
the reference should be the URL of whatever site you want the new window to be, so try this....

in the HTML

<a href="#null" onClick="javascript: openref("http://www.yahoo.com")>CLICK HERE</a>

clankid
06-12-2003, 12:00 PM
:D

Thanks, I think I've got it now!


Regards!

Khalid Ali
06-12-2003, 02:02 PM
Originally posted by Greelmo

......openref("...........

Whats that?????
unless ofcourse its a typing error..:D

Edit
I guess I was still asleep...:D

Greelmo
06-12-2003, 05:39 PM
a function name... he made the function up in his post

Charles
06-12-2003, 06:08 PM
Originally posted by Greelmo
<a href="#null" onClick="javascript: openref("http://www.yahoo.com")>CLICK HERE</a> That is wrong on three and one half accounts.

1) That will give you a link that does nothing at all for the 13% of users that do not use JavaScript. You need to provide a meaningful value for the "href" attribute.

2) The "javascript:" pseudo-protocol in the value of the "onclick" handler is an error that is ignored by some browsers.

3) Some users, especially users of non-visual browsers, navigate the site by way of a list of all of the links on the page (Ctrl-j in Opera). The link text needs to be unique and make sense out of context.

3.5) The handler's name is "onclick" and not "onClick". HTML is case insensitive and will ignore this, but XHTML is case sensitive.

<a href="http://www.w3.org/" onclick="openref(this.href); return false">W3C</a>