Current location: Hot Scripts Forums » General Web Coding » JavaScript » Help with fade buttons


Help with fade buttons

Reply
  #1 (permalink)  
Old 03-01-10, 06:10 PM
coolmark18's Avatar
coolmark18 coolmark18 is offline
Newbie Coder
 
Join Date: Oct 2005
Posts: 94
Thanks: 0
Thanked 0 Times in 0 Posts
Help with fade buttons

Please, please, can somebody tell me why this isnt working.

Code:
<script language="JavaScript">

//fades layer out
ie5 = (document.all && document.getElementById);
ns6 = (!document.all && document.getElementById);
opac2 = 100;

function fadeOut(itemnumber) {
	//document.write(opac2);
	//itemnumber = 1;
	var idname = "fade" + itemnumber;
		if(opac2 > 0){
		opac = 0;
		opac2-=1;
			if(ie5) document.getElementById(idname).filters.alpha.opacity = opac2;
			if(ns6) document.getElementById(idname).style.MozOpacity = opac2/100;
		setTimeout('fadeOut()', 0);
		//document.write(itemnumber);
	}
}
</script>

<input type="button" value="Delete This User " onClick="fadeOut(1);" >
<a href="
<input type="button" value="Delete This User " onclick="fadeOut(2)" />
<input type="button" value="Delete This User " onclick="fadeOut(3)" />
<input type="button" value="Delete This User " onclick="fadeOut(4)" />


<div id="fade1"> fade 1 here</div>
<div id="fade2"> fade 2 here</div>
<div id="fade3"> fade 3 here</div>
<div id="fade4"> fade 4 here</div>
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #2 (permalink)  
Old 03-01-10, 07:34 PM
wirehopper's Avatar
wirehopper wirehopper is offline
-
 
Join Date: Feb 2006
Posts: 2,516
Thanks: 20
Thanked 109 Times in 106 Posts
This line?

<a href="
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #3 (permalink)  
Old 03-03-10, 01:52 AM
dayworker dayworker is offline
Newbie Coder
 
Join Date: Feb 2010
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Needs some work

That's a cool little effect. Got it to work with FireFox. but not IE Created a new global ver 'it' assigning value of itemnumber. Converted fadeOut('n) parameters to strings (by putting single quotes around them) for the concatenation.
The routine get's caught up in a forever loop, however, so you might want to figure out a way to reinitialize value of opac2 to 100.

<script language="JavaScript">
var it;
//fades layer out
ie5 = (document.all && document.getElementById);
ns6 = (!document.all && document.getElementById);
opac2 = 100;

function fadeOut(itemnumber) {
//document.write(opac2);
//itemnumber = 1;
it = itemnumber;
var idname = "fade" + itemnumber;

if(opac2 > 0){
opac = 0;
opac2-=1;
}
if(ie5) document.getElementById(idname).filters.alpha.opac ity = opac2;
if(ns6) document.getElementById(idname).style.opacity = opac2/100;

setTimeout('fadeOut(it)', 0);
//document.write(itemnumber);

}

</script>

<input type="button" value="Delete This User " onClick="fadeOut('1');" />

<input type="button" value="Delete This User " onclick="fadeOut('2')" />
<input type="button" value="Delete This User " onclick="fadeOut('3')" />
<input type="button" value="Delete This User " onclick="fadeOut('4')" />


<div id="fade1"> fade 1 here</div>
<div id="fade2"> fade 2 here</div>
<div id="fade3"> fade 3 here</div>
<div id="fade4"> fade 4 here</div>
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
Reply

Bookmarks

Tags
button, fade, javascript


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
reorder radio buttons tcloud Script Requests 3 09-22-08 09:04 AM
[2005] WinXP Logoff Fade to B/W for forms? tim8w Windows .NET Programming 1 07-08-08 11:49 AM
Advanced Flash Buttons w/rollover nav menu t49518 Job Offers & Assistance 1 03-16-07 06:47 AM
using java and radio buttons to choose search. PLEASE HELP!!! shelydmb JavaScript 1 03-13-06 04:19 PM
Placing JButtons in a JPanel in a JScrollPane i.e. Scrollable buttons BigV Everything Java 2 05-26-05 12:29 PM


All times are GMT -5. The time now is 12:54 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.