Fade out DIV? Also braindead questions...

N

Noozer

Just wondering if this is possible... (and how)

I have a small VBScript routine that reduces opacity to 0 slowly.
Unfortunately it doesn't render as it changes. Is this even possible?

Sub UnPop
for i=100 to 0 step -.1
document.getElementById("popup").style.filter = "alpha(opacity=" & i &
");"
next
end Sub

And since I'm posting...

Will "document.popup.style" be the same as
"document.getElementById("popup")" ?
 
L

Leif K-Brooks

Noozer said:
Sub UnPop
for i=100 to 0 step -.1
document.getElementById("popup").style.filter = "alpha(opacity=" & i &
");"
next
end Sub

You might get better answers on a Microsoft group. This one is for
discussion of public Web pages.
 
N

Noozer

Leif K-Brooks said:
You might get better answers on a Microsoft group. This one is for
discussion of public Web pages.

I tried that answer once and was pounced upon by many of the regulars that
"this group is for pretty much anything to do with webpages"

This script is on a webpage ONCLICK event.
 
P

Philip Ronan

Noozer said:
I have a small VBScript routine that reduces opacity to 0 slowly.
Unfortunately it doesn't render as it changes. Is this even possible?

Sub UnPop
for i=100 to 0 step -.1
document.getElementById("popup").style.filter = "alpha(opacity=" & i &
");"
next
end Sub

You should try using a timer to do this, not a for/next loop (which your
browser will probably run through 100 times in about 1 millisecond).

I know nothing about VBScript, and not much about IE-only styles, but in
Javascript you could try using something like this:

function fadeOut(i)
{
document.getElementById("popup").style.filter =
"alpha(opacity=" + --t + ");"
if (t>0) setTimeOut(fadeOut,10,t);
}

fadeOut(100);
And since I'm posting...

Will "document.popup.style" be the same as
"document.getElementById("popup")" ?

Who cares? If it works in IE then that's all you need to worry about. This
stuff won't work anywhere else.
 
M

mscir

Philip said:
Noozer wrote:
You should try using a timer to do this, not a for/next loop (which your
browser will probably run through 100 times in about 1 millisecond).

I know nothing about VBScript, and not much about IE-only styles, but in
Javascript you could try using something like this:

function fadeOut(i)
{
document.getElementById("popup").style.filter =
"alpha(opacity=" + --t + ");"
if (t>0) setTimeOut(fadeOut,10,t);
}
function fadeOut(i)
{
document.getElementById("popup").style.filter =
"alpha(opacity=" + --t + ");"
if (t>0) setTimeOut(fadeOut,10,t);
}

You might try doing the lookup only once, for efficiency:

var elemPopup=document.getElementById("popup");
function fadeOut(i) {
elemPopup.style.filter="alpha(opacity=" + --t + ");"
if (t>0) setTimeOut(fadeOut,10,t);
}

Mike
 
N

n|ck

mscir said:
You might try doing the lookup only once, for efficiency:

var elemPopup=document.getElementById("popup");
function fadeOut(i) {
elemPopup.style.filter="alpha(opacity=" + --t + ");"
if (t>0) setTimeOut(fadeOut,10,t);
}

What's the point of i?

No, this isn't an existential question - I'm referring to the variable u're
passing in as a parameter.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top