Macromedia problem

Discuss all aspects of programming here.

Moderator: The Mod Squad

Macromedia problem

Postby BorderGuard » Sat Jan 21, 2006 10:50 am

I could not really decide where to put this so I am just going to drop it here.

I created my site using Macromedia products, i.e. Dreamweaver, Fireworks, Flash etc. Anyway, it sounds pretty goofy but I have been able to do most of what I want to do except produce what I will call "pop up pages". I want a page that when a button or something similar is selected, a seperate page will pop up, not attached to the site.

To explain a little better, I have produced pop up pages, well sort of. My pages, when they pop up, are still linked to the other pages so that if you close the pop up it kills the whole site and the browser for that matter. I want to have a page that will pop up, while the original page is still visible in the background, and can be be closed in and of itself without affecting the site.

I hope I have explained this well enough because I am starting to confuse myself. :)
BorderGuard
 

Postby BorderGuard » Sat Jan 21, 2006 10:57 am

Uh oh. I just read Roach412's ideas on Macromedia stuff on the for the person asking about Frontpage. :D I am embarrased now.
BorderGuard
 

Postby Falklian » Sat Jan 21, 2006 12:26 pm

Easiest way:

<a href="/yourpage.html" target="_BLANK">This will pop up a new browser window when clicked</a>

Better way would be to use JavaScript. If you're using Dreamweaver, it should have a built in function that will do everything for you.

Here's my sloppy code:

Code: Select all
function makeWinXY(url, nWidth, nHeight) {  // pop up window with height/width

              agent = navigator.userAgent;
              windowName = "xywindow";

              params  = "";
              params += "toolbar=0,";
              params += "location=0,";
              params += "directories=0,";
              params += "status=0,";
              params += "menubar=0,";
              params += "scrollbars=1,";
              params += "resizable=1,";
              params += "width=" + nWidth + ",";
              params += "height=" + nHeight;

              win = window.open(url, windowName , params);

              if (agent.indexOf("Mozilla/2") != -1 &&
agent.indexOf("Win") == -1) {
                  win = window.open(url, windowName , params);
              }

              if (!win.opener) {
                  win.opener = window;
              }

}


It works, I don't know if it's "right" though, I know jack about JavaScript ;)

Invoke it by doing so:

<a href="javascript:makeWinXY('/mypage.html',540,420)">Pop up window</a>

The first parameter is the path to your page you want to pop up, the second and third are lenght/width.

Hope that helps
Falklian
Black Belt
Black Belt
 
Posts: 921
Joined: Tue Oct 01, 2002 2:06 pm
Location: Illinois

Postby BorderGuard » Sun Jan 22, 2006 10:05 pm

Thanks, I will try it tommorow. I am sure the JavaScript will work. I am sure that it is not too complicated, I just could not figure out how to unlink the page from the rest of the site so that it would be independent, on its own.
BorderGuard
 

Postby BorderGuard » Mon Jan 23, 2006 1:14 pm

After seeing your suggestion on href, I checked the page that I had already created and realized that I left out the target="_BLANK". It works now just like I wanted. :D

I do need to work on the JavaScript though to be able to set the page size as it still comes up full screen.
BorderGuard
 

Postby Reader » Sun Feb 19, 2006 7:47 am

There's a really fine popup generator that you can use to create these.

Try JavaScriptKit Popup Window Generator

Depending on what you're trying to do, it's an advantage to disable all the buttons, address bar etc. and just keep the popup window size limited to what you actually want to show your visitors. It's also handy to enable "resize" so users can adjust it if their screen resolution varies.

When you're ready to generate, it's always nice for visitors if you select the window to be loaded on a "text link" instead of "automatically" ... in general, users don't like having a window pop up when they load a page.

-------include in html file body-----------------
Code: Select all
<script type="text/javascript">

function openpopup(popurl){
var winpops=window.open(popurl,"","width=,height=,status,resizable")
}
</script>


In the example above, you would just play with width and height until you got it where you wanted.

----------link to popup-------------
Code: Select all
<a href="javascript:openpopup('http://www.yoursite.com/yourfile.html')">Click here to open window</a>

---------------------------------------

If you have multiple popups on the same page, they should be edited to reflect that...

function openpopup1(popurl)
function openpopup2(popurl)

and called with...

href="javascript:openpopup1('http://www...etc)
href="javascript:openpopup2('http://www...etc)

Hope that helps!
reader
_ _ _____ _ _
"There we were, lost in the Wilds of Afghanistan without a corkscrew. Forced to live for days on nothing but food and water."

W.C. Fields
Reader
Anti-Static Strap
Anti-Static Strap
 
Posts: 454
Joined: Wed Oct 17, 2001 12:01 am
Location: Atlanta, GA


Return to Programming

Who is online

Users browsing this forum: No registered users and 0 guests