links clicked

M

Maria

Hello,
I would like to have help with solving an issue.

I need to present users with a nxn matrix where each cell contains a
link. Participants can click on any link they want, number of times
they want, and in the order they want. I want to be able to keep
record of which links they click on and how many times they click on
each link. I want to have a separate count for each participants.

Best regards
 
L

Luuk

Op 5-4-2010 16:47, Maria schreef:
Hello,
I would like to have help with solving an issue.

I need to present users with a nxn matrix where each cell contains a
link. Participants can click on any link they want, number of times
they want, and in the order they want. I want to be able to keep
record of which links they click on and how many times they click on
each link. I want to have a separate count for each participants.

Best regards

If the table is 4x4....


<html>
<head>

<script>
var x=new Array();

function add(t) {
if (x[t.id] == undefined) {
x[t.id]=0;
}
t.innerHTML = ++x[t.id];
}
</script>
</head>
<body>

<table border=1>
<tr>
<td id="0101" onclick="add(this);">&nbsp;&nbsp;</td>
<td id="0102" onclick="add(this);">&nbsp;&nbsp;</td>
<td id="0103" onclick="add(this);">&nbsp;&nbsp;</td>
<td id="0104" onclick="add(this);">&nbsp;&nbsp;</td>
</tr>
<tr>
<td id="0201" onclick="add(this);">&nbsp;&nbsp;</td>
<td id="0202" onclick="add(this);">&nbsp;&nbsp;</td>
<td id="0203" onclick="add(this);">&nbsp;&nbsp;</td>
<td id="0204" onclick="add(this);">&nbsp;&nbsp;</td>
</tr>
<tr>
<td id="0301" onclick="add(this);">&nbsp;&nbsp;</td>
<td id="0302" onclick="add(this);">&nbsp;&nbsp;</td>
<td id="0303" onclick="add(this);">&nbsp;&nbsp;</td>
<td id="0304" onclick="add(this);">&nbsp;&nbsp;</td>
</tr>
<tr>
<td id="0401" onclick="add(this);">&nbsp;&nbsp;</td>
<td id="0402" onclick="add(this);">&nbsp;&nbsp;</td>
<td id="0403" onclick="add(this);">&nbsp;&nbsp;</td>
<td id="0404" onclick="add(this);">&nbsp;&nbsp;</td>
</tr>
</table>

</body>
</html>
 
E

Evertjan.

Luuk wrote on 05 apr 2010 in comp.lang.javascript:
Op 5-4-2010 16:47, Maria schreef:
Hello,
I would like to have help with solving an issue.

I need to present users with a nxn matrix where each cell contains a
link. Participants can click on any link they want, number of times
they want, and in the order they want. I want to be able to keep
record of which links they click on and how many times they click on
each link. I want to have a separate count for each participants.

Best regards

If the table is 4x4....


<html>
<head>

<script>
var x=new Array();

function add(t) {
if (x[t.id] == undefined) {
x[t.id]=0;
}
t.innerHTML = ++x[t.id];
}


No need for an array
you can store the value in title="",
try any table matrix here:


<script type='text/javascript'>
var x = 4;
var y = 4;

function add(t) {
// increment the count:
t.title = ++t.title;
// and show the count if you like:
t.innerHTML = t.innerHTML.replace(/\(\d+\)$/,'('+t.title+')')
}
</script>

<style type='text/css'>
td {background-color:navy;color:yellow;font-size:15pt;padding:2px 12px;}
</style>

<table border=0>
<script type='text/javascript'>
for (i=0;i<x;i++) {
document.write('<tr>');
for (j=0;j<y;j++) {
document.write('<td onclick="add(this);" ');
document.write('title="0">a link here (0)</td>');
};
document.write('<tr>');
};
</script>
</table>
 
E

Evertjan.

Maria wrote on 05 apr 2010 in comp.lang.javascript:
I need to present users with a nxn matrix where each cell contains a
link. Participants can click on any link they want, number of times
they want, and in the order they want. I want to be able to keep
record of which links they click on and how many times they click on
each link. I want to have a separate count for each participants.

If YOU as a webmaster want to keep count of the number of clicks on a link,
in total or per logged-in user, this would need serverside coding and
database.

This can be done in Javascript, being the general subject of this NG,
on an ASP-enabled server.
 

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

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,596
Members
45,140
Latest member
SweetcalmCBDreview
Top