Hi,
I wish to select an <a>'s alt property and use it to create a message to display help to the user. This is what I've got so far:
<!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" xml:lang="en" lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<meta http-equiv="content-language" content="zh-HK" />
<script type="text/javascript" src="includes/js/mootools-1.2.5-core-nc.js"></script>
<title>MooTools: Lab</title>
<script type="text/javascript">
window.addEvent('domready', function()
{
$('help').setStyle('opacity', 0);
$$('.help').addEvents({
'mouseover' : function() {
var message = $(this).getProperties('alt');
$('help').set('html', '<p>' + message + '</p>');
$('help').tween('opacity', 1);
},
'mouseout' : function() {
$('help').tween('opacity', 0);
}
});
$$('tr:even').highlight('#fff');
});
</script>
<style>
table {
border: 2px solid #333;
width: 50%;
margin: auto;
}
table tr.even {
background-color: #666;
color: #fff;
}
table tr th {
background-color: #333;
color: #fff;
}
table tr th a {
text-decoration: none;
color: #fff;
}
table tr td {
border: 2px solid #333;
margin: 0px;
padding: 0px;
}
div#help {
width: 948px;
margin: auto;
border: 2px solid #333;
}
div#help p {
display: block;
text-align: center;
}
</style>
</head>
<body>
<table>
<tr>
<th>Date <span class="help"><a href="#" alt="This shows the Date column.">(?)</span></a></th>
<th>Subject <span class="help"><a href="#" alt="This shows the Subject column.">(?)</span></a></th>
<th>Tutor <span class="help"><a href="#" alt="This shows the Tutor column.">(?)</span></a></th>
<th>Centre <span class="help"><a href="#" alt="This shows the Centre column.">(?)</span></a></th>
<th>Type <span class="help"><a href="#" alt="This shows the Tutor column.">(?)</span></a></th>
</tr>
<tr>
<td>2010-08-29</td>
<td>English</td>
<td>Mr. Brown</td>
<td>HH</td>
<td>Live</td>
</tr>
<tr class="even">
<td>2010-09-05</td>
<td>Science</td>
<td>Mr. Blue</td>
<td>HH</td>
<td>Live</td>
</tr>
<tr>
<td>2010-10-01</td>
<td>Business</td>
<td>Miss Pink</td>
<td>HH</td>
<td>Live</td>
</tr>
<tr class="even">
<td>2010-09-15</td>
<td>Math</td>
<td>Mr. Black</td>
<td>HH</td>
<td>Live</td>
</tr>
<tr>
<td>2010-10-03</td>
<td>English</td>
<td>Mr. Beige</td>
<td>HH</td>
<td>Video</td>
</tr>
</table>
<div id="help"></div>
</body>
</html>
Any ideas?
Thanks,
Julian