PDA

View Full Version : tables, links and mouse events


dco
11-10-2006, 12:12 AM
I have a site with several very long tables composed of links to pop-up windows (not uploaded yet). The link is made using # in the link box, and selecting a behavior from the behaviors panel, which in this case is 'open browser window'. I have several mouse options to choose from, and I need to know if there is one that will leave the page where it is when a link is selected. Right now, I am using 'Mouse Up' but each link clicked sends the original page back to the top again. Very frustrating when you want to go thru all the links.

If there is no way around this, can someone suggest a better way. The actual popup windows are not very large and so i was hoping to avoid using a whole page for them. Other pages on the site also have numerous images that would also link to a popup window, also very small.

Thank you

dreamlynx
11-10-2006, 12:24 AM
onclick

dco
11-10-2006, 12:37 AM
Sorry, tried onClick and it didn't work. Page still jumps to top.

To claim to know it all is the height of stupidity. Recognition of our ignorance the beginning of knowledge. To call upon God, the greatest wisdom of all.

domedia
11-10-2006, 01:40 AM
welcome to the club dco :)

The reason the page jumps to the top of the page is because it's trying to find the location '#'.

So the problem is not directly related to your javascript and Open Browser behaviour, but to the link the browser is trying to find. Luckily there's a way in javascript to make the browser ignore the 'href' element. Use the code 'return(false)' to tell the browser to ignore the link. Here's an example:
Link (pop.html)

In the example above I even replaced the '#' with the real URL, in case that 1% visitor comes by with javascript turned off, so they'll be able to navigate as well. ;)

dco
11-10-2006, 02:20 AM
thanks domedia.

I tried the code just as you wrote it, changing only the <Link> portion to the name of the link in my site, and when I did this, the popup window showed up, but the base page went 404 error.

I tried inserting only the ;return(false); portion at the end of the javacode but the base page still goes to the top.

Perhaps I am not understanding the code aright.

Do your words in the href "pop.html" mean to type just that, and keep the other pop-references as is, or do you mean to type in the file name of the actual file for the popup? I tried to do it that way too, but still got a 404 error.

And then it occurs to me, is it possible that it is a Firefox browser problem?

domedia
11-10-2006, 03:19 AM
Yeah you got it a little wrong.. 'pop.html' is the same exact page as in the popup window in my example, you'll have to change it to your own page.

Here comes lesson #1 in getting help: post your code (the <a> link) and I can give you direct help which will work for you. Guessing what your code looks like is often hard ;)

Just post the link part of your code in here, and I'll show you how it works, one you see it it should all make sense.

dco
11-10-2006, 11:19 AM
Thank you. Here is the code. I was using mouseup because on my old Dreamweaver 4, it was what worked to keep page from going to the top. It doesn't work like that on Dreamweaver 8, but I haven't changed things over yet till I find a solution.


[<a href="#" onmouseup="MM_openBrWindow('cat_q1-98/24.htm','','width=640,height=160')">What
is sin?</a>quote]

Thanks again.[/quote]

domedia
11-10-2006, 12:41 PM
Here ya go dco, look at this close, does it make more sense what it's doing now?
<a href="cat_q1-98/24.htm" onmouseup="MM_openBrWindow('cat_q1-98/24.htm','','width=640,height=160'); return(false);">What
is sin?</a>

-href="cat_q1-98/24.htm" <-sets the location of the link
-onmouseup <- the javascript that calls the javascript function to create a new window
-return(false); <- javascript tells the browser to ignore the link in href

dco
11-10-2006, 09:08 PM
Thank you for the code. It does makes sense now (thank you ever so much for your explanations) except . . .

I pasted your code directly into my page where I got my sample for you, and what happens is that I get my popup browser window as requested, but now the main page changes to the same as the contents of the popup window, instead of staying as the original page.

dco
11-11-2006, 01:11 AM
I go to the properties panel, and in the place for link I enter the word popup.php

Then I go to the code itself and at the end of the code I write in return(false)

and voila!!! my popup window opens as specified AND my original page stays in place, and in the same place.

thanks go to a writeup at www.apptools.com/rants/popups.php that I found through the dreamweaver forums at the adobe site.

Thank you domedia for all your help, especially your explanations. They were a great help, and helped me to figure out what to search for on the forum.

domedia
11-11-2006, 01:53 AM
Hey glad I could help, I might just write a tutorial like that up myself. Plenty of people that asks for help on the topic, and it would be nice to have an adequate explanation handy, so thank you! :)