popup not poping

B

Buz Waitz

I have tried several different versions of javascript to pop up a window
from an aspx page. The problem is, that the new page pops up in the current
window, not in a popup. The code works in a regular HTML page, using
Dreamweaver. I've also used code generators, tried by hand, you name it.
Same result. Here's one version of code I used:

<script language="javascript" type="text/javascript">
<!--
function PT_poppwin(theURL,winName) { //v2.0
window.open(theURL,winName,'scrollbars=1,width=300,height=600');
}
//-->
</script>

<a href="listsinfo.aspx" onMouseDown="PT_popwin('listsinfo.aspx','Lists')">
Lists</a>

Any suggestions on how to pop open a new window? Thanks.

Buz
 
C

Cristian Suazo

Hi Buz,

try adding return false after your function PT_popwin or that you return
false from your function PT_popwin always. Like this:

**************************
script language="javascript" type="text/javascript">
<!--
function PT_poppwin(theURL,winName) { //v2.0
window.open(theURL,winName,'scrollbars=1,width=300,height=600');
return false;
}
//-->
</script>

<a href="listsinfo.aspx" onMouseDown="return
PT_popwin('listsinfo.aspx','Lists')">Lists</a>

**************************
or like this:

<a href="listsinfo.aspx" onMouseDown="return
PT_popwin('listsinfo.aspx','Lists');return false;">Lists</a>


Hope this is useful to you
Cheers
Cristian
 
B

bloomfield

I guess it has something to do with the wrong function name
in script: PT_poppwin
in href: PT_popwin

I also recomand using
onclick="PT_popwin('listsinfo.aspx','Lists'); return false;"
and not onMouseDown
 
H

Hans Kesting

Buz Waitz said:
I have tried several different versions of javascript to pop up a window
from an aspx page. The problem is, that the new page pops up in the current
window, not in a popup. The code works in a regular HTML page, using
Dreamweaver. I've also used code generators, tried by hand, you name it.
Same result. Here's one version of code I used:

<script language="javascript" type="text/javascript">
<!--
function PT_poppwin(theURL,winName) { //v2.0
window.open(theURL,winName,'scrollbars=1,width=300,height=600');
}
//-->
</script>

<a href="listsinfo.aspx" onMouseDown="PT_popwin('listsinfo.aspx','Lists')">
Lists</a>

Any suggestions on how to pop open a new window? Thanks.

Buz

Possibly a typing error in your post, but I noticed that the function definition
uses PT_poppwin (double p), and that you call PT_popwin (single p).

The current window gets changed because of the "href". As others replied,
you need to add "return false" to the event handler:
<a ... onMouseDown="PT_popwin('listsinfo.aspx','Lists'); return false">

Hans Kesting
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top