yoyoyo
12-22-2008, 09:48 PM
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<style type="text/css">
/*Display info*/
#tt {z-index:200;position:absolute; display:block; background:url(images/tt_left.gif) top left no-repeat}
#ttcont {z-index:200;display:block; padding:2px 12px 3px 7px; width:50px;height:50px;text-align:center;margin-left:5px; background:#000; color:#FFF}
/*Display info*/
body,div{
overflow: hidden;;cursor:default;
font:8pt Tahoma;color:#000;
}
</style>
<script type="text/javascript">
function combination(){
document.write("<span onmouseover=\"tooltip.show('<span id=plastic2>None</span>');\" onmouseout=\"tooltip.hide();\" id=\"plastic1\">See number</span>");
}
function change(num){
var numbers=["One","Two","Three"];
for (var a=0; a<numbers.length; a++)
if (num==a){
document.getElementById('plastic1').innerHTML=numbers[a]
document.getElementById('plastic2').innerHTML=numbers[a]}
}
function checkhowmanyspan()
{
var x=document.getElementsByTagName("span");
alert(x.length);
}
</script>
</head>
<body>
<br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><center>
<script type="text/javascript">combination();</script><br /><br /><br />
Change:<br />
<a href="#" onclick="change(0)">One</a> <br />
<a href="#" onclick="change(1)">Two</a> <br />
<a href="#" onclick="change(2)">Three</a> <br /> <br />
<script type="text/javascript" src="http://sandbox.leigeber.com/tooltip/script.js"></script>
<input type="button" onclick="checkhowmanyspan()" value="How many span elements?" />
</body>
</html>
I have checked it has two span elements and I want to change the content in both span. But the problem is it can change the one in the page but not the other fade one. What I guess is it is inside a function and I am not sure how to do it. Can anyone help me out?
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<style type="text/css">
/*Display info*/
#tt {z-index:200;position:absolute; display:block; background:url(images/tt_left.gif) top left no-repeat}
#ttcont {z-index:200;display:block; padding:2px 12px 3px 7px; width:50px;height:50px;text-align:center;margin-left:5px; background:#000; color:#FFF}
/*Display info*/
body,div{
overflow: hidden;;cursor:default;
font:8pt Tahoma;color:#000;
}
</style>
<script type="text/javascript">
function combination(){
document.write("<span onmouseover=\"tooltip.show('<span id=plastic2>None</span>');\" onmouseout=\"tooltip.hide();\" id=\"plastic1\">See number</span>");
}
function change(num){
var numbers=["One","Two","Three"];
for (var a=0; a<numbers.length; a++)
if (num==a){
document.getElementById('plastic1').innerHTML=numbers[a]
document.getElementById('plastic2').innerHTML=numbers[a]}
}
function checkhowmanyspan()
{
var x=document.getElementsByTagName("span");
alert(x.length);
}
</script>
</head>
<body>
<br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><center>
<script type="text/javascript">combination();</script><br /><br /><br />
Change:<br />
<a href="#" onclick="change(0)">One</a> <br />
<a href="#" onclick="change(1)">Two</a> <br />
<a href="#" onclick="change(2)">Three</a> <br /> <br />
<script type="text/javascript" src="http://sandbox.leigeber.com/tooltip/script.js"></script>
<input type="button" onclick="checkhowmanyspan()" value="How many span elements?" />
</body>
</html>
I have checked it has two span elements and I want to change the content in both span. But the problem is it can change the one in the page but not the other fade one. What I guess is it is inside a function and I am not sure how to do it. Can anyone help me out?