Forum Moderators: open

Message Too Old, No Replies

Check this javascript code

         

Tekture

4:30 pm on Jan 23, 2005 (gmt 0)

10+ Year Member



can someone look at this code and tell me why its not working?

<img src="Assets/arrows.gif" width="8" height="6"> <font color="#000099"><strong><a href="javascript:;" onClick="MM_openBrWindow('newsletter.html','','status=yes')">Newsletter</a></strong></font><br>

warp_fr

4:41 pm on Jan 23, 2005 (gmt 0)

10+ Year Member



try this :

...
<a href="newsletter.html" target="myPopup" onClick="javascript:MM_openBrWindow('newsletter.html','myPopup','status=yes');false;">Newsletter</a>
...

I don't know exactly what MM_openBrWindow() is doing but I believe it opens a popup window. It's better to give the new window a name ("myPopup" here, but you can change it to whatever).

Bernard Marx

4:42 pm on Jan 23, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



It looks OK, as long as
MM_openBrWindow
is actually implemented somewhere.
(The image tag seems to be irrelevant)

RE: warp_fr's suggestion.

Good idea that (support for non-JS).
..but that's

"...; [red]return[/red] false;"

topr8

4:46 pm on Jan 23, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



a href="javascript:;"

is the :; a typo or is it in your code?

Tekture

5:16 pm on Jan 23, 2005 (gmt 0)

10+ Year Member



i placed the code just like i used it
When clicking on the link it will go to an error page where the address is [javascript:;...]

rocknbil

7:47 pm on Jan 23, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



All of the code generated by any Macromedia project (Dreamweaver, Flash, etc.) begins with MM. This a Macromedia-generated Javascript snip (unless someone imitated it. :-) )

To see why MM_openBrWindow doesn't work you'd have to paste that code in, but I can tell you it would be easier to learn Javascript and write one yourself, MM's auto functions are usually very heavy.

Couple other things:

<a href="javascript:;" onClick="MM_openBrWindow('newsletter.html','','status=yes')">Newsletter</a>

I use href="javascript:" all the time but it's not the Thing to Do, because if Javascript is disabled, then you get weird errors and no links. If you DO want to do this is should be

<a href="javascript:MM_openBrWindow('newsletter.html','','status=yes');">Newsletter</a>

If not, make the href a link to an anchor on the page or simply # which will link to the current page:

<a href="#theTop" onClick="MM_openBrWindow('newsletter.html','','status=yes'); return false;">Newsletter</a>

<a href="#" onClick="MM_openBrWindow('newsletter.html','','status=yes'); return false;">Newsletter</a>

Paste the MM_openBrWindow code in here and someone will be able to tell why it's not working.

Tekture

9:54 pm on Jan 23, 2005 (gmt 0)

10+ Year Member



Warp, your code works, yet it doesnt open the window like it should

The link is on www.smlre.com under newsletter.

right now, i am using the script suggested by warp
What i want, is to get the window to open up with just the status bar, and the size of the grey table.

Any suggestions?

Bernard Marx

11:22 pm on Jan 23, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



This is your current code:

onclick="javascript:MM_openBrWindow('newsletter.html','myPopup','status=yes');false;"

1. The

javascript:
protocol is redundant in an event handler.
2. (as mentioned prev.) the second statement should be

[b]return[/b] false

3. All implementations of Macromedia's

MM_openBrWindow
, that I have seen, do nothing, essentially.
The function just passes it's arguments to the native window method,
open
.

So the whole thing:


[pre]<a onclick="window.open('newsletter.html','mypopup','width=200,height=200,status=1'); return false;" 
href="newsletter.html"
target="mypopup">newsletter</a>[/pre]

Alter

width
&
height
according to taste.

warp_fr

11:34 am on Jan 24, 2005 (gmt 0)

10+ Year Member



edited

adni18

10:53 pm on Jan 24, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Instead of using javascript:; try using javascript:void(0);