PDA

View Full Version : HTML Link and onClick


toxalot
10-15-2002, 09:06 AM
I have several popup links in my web page like what I want and they work great. I now need one in my Flash movie and wondering how I would get the same effect.

My HTML code is as follows:

<a href="/diy_postcard_prices.html" target="newWindow" onClick="PopUp(this.href, 'newWindow', 510, 450); return false">

The effect I want is for the link to open in the pop up if possible, but will still work if Javascript is disabled.

Jennifer

toxalot
10-18-2002, 07:58 PM
Anyone?

I can think of different ways of doing an HTML link OR JS link, but can't think of a way of having a JS link and only use HTML if no JS.

I really like having it be a pop up, but still want the link to work even if JS disabled.

Jennifer

jimburton
10-18-2002, 11:52 PM
you could do something like wait til the movie is loaded and send a message from javascript to the movie nd if it gets there then you know you're working, do the pop-up, therwise just link to a new page...maybe:


//in the web page
function sayHello() {
document.movie.SetVariable("saidHello","true");
}

//in the movie
saidHello = false;
getURL("javascript:sayHello();");
if(!saidHello) {
//do one thing
} else {
//do the other
}


providing your movie has the name and id parts of the html tags set to 'movie'

learning from experience, I tried this code and it works :)

toxalot
10-19-2002, 01:53 AM
I tried the code as is. Ensuring that JS is enabled and the name attribute of the embed tag is set to movie as well as id in the object tag.

saidHello is always false

The Mozilla debugger says
document.movie.SetVariable is not a function

I tried adding swLiveConnect=true and using window.document.movie.SetVariable("saidHello","true");

as described here
http://www.macromedia.com/support/flash/ts/documents/set_variables.htm#javascript

And still doesn't work. The function is getting called. I know cuz I added an alert to see.

Jennifer

jimburton
10-19-2002, 07:06 PM
sorry, only tried it in IE - the SetVariable and assoc functions only work in IE, so this approach has a limited usefulness, but it's the only one I can think of...if you run the attached files in IE you'll see it working...

If I were you I would be happy to lose the tiny minority of people who turn off javascript unless you're doing a government or other 100% accessible site, in which case pop-ups probably aren't the thing...?

toxalot
10-19-2002, 09:39 PM
I had tried it in IE too and couldn't get it to work there although I didn't get the error. I will try yours and see if I get that one to work and what I did differently.

I have JS turned on, but JS only links are one of my biggest surfing pet peeves. I use my middle mouse button to open in a new tab and I can't do that with a JS link. It really bugs me when I am not given the choice. I also want to know the url of where I am going.

Jennifer