Need to control popup size from menu button

Post your questions and problem reports here.

Need to control popup size from menu button

Postby mike519 » Fri Nov 13, 2009 2:22 am

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
mike519
 
Posts: 9
Joined: Wed Nov 11, 2009 5:51 am

Re: Need to control popup size from menu button

Postby MikeyB » Fri Nov 13, 2009 11:00 am

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>
User avatar
MikeyB
Top Contributor
 
Posts: 511
Joined: Fri Jun 09, 2006 10:38 am
Location: UK

Re: Need to control popup size from menu button

Postby mike519 » Sat Nov 14, 2009 1:52 am

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!
mike519
 
Posts: 9
Joined: Wed Nov 11, 2009 5:51 am

Re: Need to control popup size from menu button

Postby MikeyB » Mon Nov 16, 2009 10:57 am

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
MikeyB
Top Contributor
 
Posts: 511
Joined: Fri Jun 09, 2006 10:38 am
Location: UK

Re: Need to control popup size from menu button

Postby Karlis » Mon Nov 16, 2009 9:36 pm

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
User avatar
Karlis
Site Admin
 
Posts: 3598
Joined: Mon Jul 15, 2002 5:24 pm
Location: Riga, Latvia, Europe

Re: Need to control popup size from menu button

Postby mike519 » Wed Nov 18, 2009 5:09 am

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)...
mike519
 
Posts: 9
Joined: Wed Nov 11, 2009 5:51 am

Re: Need to control popup size from menu button

Postby Karlis » Thu Nov 19, 2009 7:35 pm

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
User avatar
Karlis
Site Admin
 
Posts: 3598
Joined: Mon Jul 15, 2002 5:24 pm
Location: Riga, Latvia, Europe

Re: Need to control popup size from menu button

Postby mike519 » Fri Nov 20, 2009 3:17 am

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.
mike519
 
Posts: 9
Joined: Wed Nov 11, 2009 5:51 am

Re: Need to control popup size from menu button

Postby MikeyB » Fri Nov 20, 2009 1:23 pm

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>
User avatar
MikeyB
Top Contributor
 
Posts: 511
Joined: Fri Jun 09, 2006 10:38 am
Location: UK

Re: Need to control popup size from menu button

Postby mike519 » Mon Nov 23, 2009 4:53 am

Awesome! That works...thanks a ton!!
mike519
 
Posts: 9
Joined: Wed Nov 11, 2009 5:51 am

Re: Need to control popup size from menu button

Postby petergriffin » Sat Jan 23, 2010 11:33 am

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
petergriffin
 
Posts: 1
Joined: Tue Jan 19, 2010 1:30 pm


Return to Easy Button & Menu Maker Support

Who is online

Users browsing this forum: No registered users and 10 guests