JavaScript - Where are me error?

 
Vista:

Where are me error?

Publicado por jason (1 intervención) el 02/09/2011 15:51:27
Where are my error?

I can't to do the effect Opacity

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Documento sin título</title>
<style type="text/css">
#apDiv1 {
	position:absolute;
	width:200px;
	height:115px;
	z-index:1;
	left: 105px;
	top: 137px;
	overflow: hidden;
}
#apDiv2 {
	position:absolute;
	left:63px;
	top:184px;
	width:30px;
	height:23px;
	z-index:2;
	background-color: #000000;
}
#apDiv3 {
	position:absolute;
	left:313px;
	top:185px;
	width:30px;
	height:23px;
	z-index:2;
	background-color: #000000;
}
#apDiv4 {
	position:absolute;
	left:193px;
	top:276px;
	width:30px;
	height:23px;
	z-index:2;
	background-color: #000000;
}
</style>
<script language="javascript">
 
	function div_scrollbar (id,to)
	{
		var obj = document.getElementById(id);
		if (to=='>'){obj.scrollLeft+=240;}
		if (to=='<'){obj.scrollLeft-=240;}
	}
 
	function efec_des (id,lvl)
	{
		function put(lvl)
		{
			if(Number(lvl))
			{
				if(obj.style.opacity=lvl){;}
				else if(obj.style.filter = "alpha(opacity="+(lvl * 100)+");"){;}
				else if(obj.style.MozOpacity=lvl){;}
				else if(obj.style.KhtmlOpacity=lvl){;}
			}
		}
 
		var obj = document.getElementById(id);
		var t;
		if (Number(lvl)){put(lvl);}
		if(lvl=='on')
		{
			for (i=0;i<=1;i+=(1/40))
			{
				setTimeout(put(i),300);
			}
		}
		if(lvl=='off')
		{
			for (i=1;i<=0;i-=(1/40))
			{
				setTimeout(put(i),300);
			}
		}
	}
 
</script>
 
</head>
 
<body>
<div id="apDiv1">
<img src="http://www.google.com.bo/images/srpr/logo3w.png" />
</div>
<div id="apDiv2" onclick="div_scrollbar('apDiv1','<');efec_des('apDiv1','on');"></div>
<div id="apDiv3" onclick="div_scrollbar('apDiv1','>');efec_des('apDiv1','on');"></div>
<div id="apDiv4" onclick="efec_des('apDiv1',0.2);"></div>
</body>
</html>
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder