Page 1 of 1

Need to control popup size from menu button

PostPosted: Fri Nov 13, 2009 2:22 am
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

Re: Need to control popup size from menu button

PostPosted: Fri Nov 13, 2009 11:00 am
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>

Re: Need to control popup size from menu button

PostPosted: Sat Nov 14, 2009 1:52 am
by mike519
I have been using a pop up generator from this website:

http://javascript.internet.com/generators/popup-window.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!

Re: Need to control popup size from menu button

PostPosted: Mon Nov 16, 2009 10:57 am
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

Re: Need to control popup size from menu button

PostPosted: Mon Nov 16, 2009 9:36 pm
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();"

Re: Need to control popup size from menu button

PostPosted: Wed Nov 18, 2009 5:09 am
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)...

Re: Need to control popup size from menu button

PostPosted: Thu Nov 19, 2009 7:35 pm
by Karlis
First, you have double = signs in your code (href=="). It is wrong, there should be only one = sign.

Re: Need to control popup size from menu button

PostPosted: Fri Nov 20, 2009 3:17 am
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.

Re: Need to control popup size from menu button

PostPosted: Fri Nov 20, 2009 1:23 pm
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>

Re: Need to control popup size from menu button

PostPosted: Mon Nov 23, 2009 4:53 am
by mike519
Awesome! That works...thanks a ton!!

Re: Need to control popup size from menu button

PostPosted: Sat Jan 23, 2010 11:33 am
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.