Free Republic
Browse · Search
General/Chat
Topics · Post Article

Skip to comments.

(vanity) Javascript help needed
Tanniker Smith

Posted on 04/18/2007 8:39:33 AM PDT by Tanniker Smith

FReepers have come through to help me before, and I'm hoping that you can do it again.

I have a school webpage, and I'm trying to improve their default layouts a little bit. Basically, I have a script that I found in a tutorial to open up a popup window. I want to use the same popup window for a bunch of different vocabulary words, so that the student doesn't wind up with 15 windows open.

Here's my problem. The first window pops up. After that, the new page will go into the same window, but it doesn't get the focus (if that's the right word). The popup is behind the page with the vocabulary words, instead of in front of it.

Here is the code that I've been using:

< SCRIPT TYPE="text/javascript" >
<!--
function popup(mylink, windowname)
{
if (! window.focus)return true;
var href;
if (typeof(mylink) == 'string')
href=mylink;
else
href=mylink.href;
window.open(href,
windowname, 'width=400,height=200,scrollbars=yes');
return false;
}
//-->
</SCRIPT>

< script type="text/javascript">
//< ![CDATA[
<!--
function popup(mylink, windowname)
{
if (! window.focus)return true;
var href;
if (typeof(mylink) == 'string')
href=mylink;
else
href=mylink.href;
window.open(href, windowname, 'width=400,height=400,scrollbars=yes');
return false;
}
//-->
//]]>


.
.
.


< tr>
< td>Mean</td>
< td>< a onclick="return popup(this, 'voc')" href="voc_mean.html">Definition< /a>
< /tr>

Do I have to do something with this script? Or do I have to add it to the page that is being loaded in the popup window?


TOPICS: Computers/Internet
KEYWORDS: html; javascript
Do I have to do something with this script? Or do I have to add it to the page that is being loaded in the popup window?

Thanks in advance for your help!

1 posted on 04/18/2007 8:39:35 AM PDT by Tanniker Smith
[ Post Reply | Private Reply | View Replies]

To: JRandomFreeper

Can you help?


2 posted on 04/18/2007 8:44:07 AM PDT by Dog
[ Post Reply | Private Reply | To 1 | View Replies]

To: Tanniker Smith

First of all avoid pop-ups like the plague!! - explore DHTML layers instead.


3 posted on 04/18/2007 8:46:41 AM PDT by RC51
[ Post Reply | Private Reply | To 1 | View Replies]

To: Tanniker Smith

When that fails use:

//— Begin Script —
var newwindow = ‘’;

function popitup(url) {
if (!newwindow.closed && newwindow.location) {
newwindow.location.href = url;
}
else {
newwindow=window.open(url,’name’,’height=200,width=150’);
if (!newwindow.opener) newwindow.opener = self;
}
if (window.focus) {newwindow.focus()}
return false;
}

//— End Script —


4 posted on 04/18/2007 8:47:33 AM PDT by RC51
[ Post Reply | Private Reply | To 1 | View Replies]

To: RC51
First of all avoid pop-ups like the plague!! - explore DHTML layers instead.

When summer vacation starts, I'll look into it. Right now, I'm using my (really old) HTML coding skills with the teeny bits of javascript or perl that I know (actually, I forgot all the perl that I ever knew, except for a handful of scripts that I currently have.)

Whatever you call them, I need to have a second window. I hate the layout of the school's website as it is, so I'm doing what I can with the parts that I can control. And it beats geocities.com, which was also free, but had ads which the principal probably would've frowned upon had he noticed.

Thanks for the assist. I'll give it a try during my next prep.

5 posted on 04/18/2007 10:13:32 AM PDT by Tanniker Smith (I didn't know she was a Liberal when I married her.)
[ Post Reply | Private Reply | To 3 | View Replies]

To: RC51
Thanks, again.

It seems to be doing the same thing. When I go back to the main page, the window "disappears" under it, and when I click on the next word, the window doesn't pop up again although if I click it on the taskbar, it has the new page loaded.

Guess I should start looking into DHTML.

TS

6 posted on 04/18/2007 6:52:53 PM PDT by Tanniker Smith (I didn't know she was a Liberal when I married her.)
[ Post Reply | Private Reply | To 4 | View Replies]

Disclaimer: Opinions posted on Free Republic are those of the individual posters and do not necessarily represent the opinion of Free Republic or its management. All materials posted herein are protected by copyright law and the exemption for fair use of copyrighted works.

Free Republic
Browse · Search
General/Chat
Topics · Post Article

FreeRepublic, LLC, PO BOX 9771, FRESNO, CA 93794
FreeRepublic.com is powered by software copyright 2000-2008 John Robinson