Need to control popup size from menu button

Post your questions and problem reports here.
Post Reply
mike519
Posts: 9
Joined: Wed Nov 11, 2009 5:51 am

Need to control popup size from menu button

Post by mike519 »

OK, I have my buttons working well now thanks to mikeyb but have one more problem...

Before I was using the drop down menu created with this software, I had a text link to a webpage to play a youtube video. The video object is a fixed dimension and I had used javascript to popup the page with the same dimensions so that, basically, the link opened a window with no toolbars, etc and was the exact size of the video, in the middle of the screen.

I tried to copy the same javascript into the <a href link that appears in the code for the drop down menu but it doesn't work.

Basically, how can a drop down button open a popup of fixed dimension?

Thanks

Mike
User avatar
MikeyB
Top Contributor
Posts: 511
Joined: Fri Jun 09, 2006 10:38 am
Location: UK
Contact:

Re: Need to control popup size from menu button

Post by MikeyB »

What code have you tried to put in the href?

I would put the JavaScript code in a function in your <head> section:

Code: Select all

<head>
... you existing head stuff ...
<script type="text/javascript">
function YourFunction() {
code to do your popup;
}
</script>
</head>
and then the href would be:

Code: Select all

<a href="javascript:YourFunction()">Link text</a>
mike519
Posts: 9
Joined: Wed Nov 11, 2009 5:51 am

Re: Need to control popup size from menu button

Post by mike519 »

I have been using a pop up generator from this website:

http://javascript.internet.com/generato ... indow.html

Here is the script code I was using, but I have to admit, I do not know javascript. I barely know html!! :) Way back when I used to do a lot more site design and did a fair amount of Flash and actionscript but that's been a long time...

function popUp(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=560,height=340,left = 360,top = 230');");
}


and for the href...

<A HREF="javascript:popUp('http://www.onotsky.net/faceoflovevideo.html')">Open the Popup Window</A>


I appreciate any help you can be. At the end of the day, I just want the link to bring up a page with a fixed size of 560x340 with no resize, sccroll, toolbars, etc and also be centered.

Thanks a ton!
User avatar
MikeyB
Top Contributor
Posts: 511
Joined: Fri Jun 09, 2006 10:38 am
Location: UK
Contact:

Re: Need to control popup size from menu button

Post by MikeyB »

Well that code works fine on a test HTML page, but if it works with the menu maker code I couldn't say as I don't have the software.

So nothing wrong with that code you posted on it's own, it's if they both work together.

Do you get any error messages when used from your menu?
Can you post a link to your page with it on?

Mike
User avatar
Karlis
Site Admin
Posts: 3605
Joined: Mon Jul 15, 2002 5:24 pm
Location: Riga, Latvia, Europe
Contact:

Re: Need to control popup size from menu button

Post by Karlis »

Make sure the code copied in href is formatted correctly. E.g. It must begin with javascript:

Probably you should isolate the code into a function and use something like this href="javascript:DoMyCode();"
Karlis Blumentals
Blumentals Software
www.blumentals.net
mike519
Posts: 9
Joined: Wed Nov 11, 2009 5:51 am

Re: Need to control popup size from menu button

Post by mike519 »

Thanks for the help guys...still not working though. Check out this link:

http://www.onotsky.net/multimediatest.html

Click on the video button, then Uganda (Face of Love)...
User avatar
Karlis
Site Admin
Posts: 3605
Joined: Mon Jul 15, 2002 5:24 pm
Location: Riga, Latvia, Europe
Contact:

Re: Need to control popup size from menu button

Post by Karlis »

First, you have double = signs in your code (href=="). It is wrong, there should be only one = sign.
Karlis Blumentals
Blumentals Software
www.blumentals.net
mike519
Posts: 9
Joined: Wed Nov 11, 2009 5:51 am

Re: Need to control popup size from menu button

Post by mike519 »

Sorry, that was a new error when I edited the code this time but it still will not work even after I deleted one of the equals signs.
User avatar
MikeyB
Top Contributor
Posts: 511
Joined: Fri Jun 09, 2006 10:38 am
Location: UK
Contact:

Re: Need to control popup size from menu button

Post by MikeyB »

Hi,

There seems to be something "odd" going on with Firefox 3.5.5, it's not running the JavaScript function at all, and simply going to the faceoflovevideo page like a normal link. As soon as you take the link out of the JavaScript call it then will call the function.
Never had this problem before with Firefox, could be a bug with latest versions?
Works fine for me in IE so to me it looks like just a problem with Firefox.

Anyway, this code works for me on a simple test page in both Firefox & IE:

Code: Select all

<a href="#" onclick="popUp('http://www.onotsky.net/faceoflovevideo.html')" title="">Uganda (Face of Love)</a>
mike519
Posts: 9
Joined: Wed Nov 11, 2009 5:51 am

Re: Need to control popup size from menu button

Post by mike519 »

Awesome! That works...thanks a ton!!
petergriffin
Posts: 1
Joined: Tue Jan 19, 2010 1:30 pm

Re: Need to control popup size from menu button

Post by petergriffin »

MikeyB wrote:What code have you tried to put in the href?

I would put the JavaScript code in a function in your <head> section:

Code: Select all

<head>
... you existing head stuff ...
<script type="text/javascript">
function YourFunction() {
code to do your popup;
}
</script>
</head>
and then the href would be:

Code: Select all

<a href="javascript:YourFunction()">Link text</a>

Thanks for this. Well done.
Harry Head
BSc Med Science
Thyromine Research
Post Reply