Friday, 30 January 2015

Save current BGColor of the Cell into XML



I need to save the value of Bgcolor of column 1 from my table and have it available once i've refreshed the page. The background color on column1 will alter from Red or green once clicked.


This is done in SharePoint so I'm thinking that the simplest way is to save the background color value into an XML file which is saved in SharePoint as well.


I'm new to XML and I don't have access to do server side database like PHP or ASP.



<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<html xmlns="http://ift.tt/lH0Osb">

<head>
<title> </title>

</head>

<body>

<table border="3" width="100%" cellspacing="0" style="text-align: center;">
<tbody>
<tr>
<td colspan="3" style="width: 595px;">
<strong>Bridges</strong></td>
</tr>

<tr>
<td>Bridge</td>
<td>Host Access Code (0001)</td>
<td>Participant Code</td>
</tr>

<tr>
<td onclick="myFunction(this)">1</td>
<td>45645645</td>
<td>45645644</td>
</tr>


<tr>
<td onclick="myFunction(this)">2</td>
<td>45645645</td>
<td>45645646</td>
</tr>


<tr>
<td onclick="myFunction(this)">3</td>
<td>45645666</td>
<td>45645645</td>
</tr>


<tr>
<td onclick="myFunction(this)">4</td>
<td>45645645</td>
<td>45645666</td>
</tr>

<tr>
<td onclick="myFunction(this)">5</td>
<td>456456456</td>
<td>456456456</td>
</tr>

<tr>
<td onclick="myFunction(this)">6</td>
<td>45645666</td>
<td>45645646</td>
</tr>

<tr>
<td onclick="myFunction(this)">7</td>
<td>45645645</td>
<td>45645666</td>
</tr>

<tr>
<td onclick="myFunction(this)">8</td>
<td>45645645</td>
<td>45645645</td>
</tr>

<tr>
<td onclick="myFunction(this)">9</td>
<td>45645645</td>
<td>45645645</td>
</tr>

<tr>
<td onclick="myFunction(this)">10</td>
<td>45645645</td>
<td>45645664</td>
</tr>

</tbody>
</table>

<script type="text/javascript">
function myFunction(x) {
if (x.bgColor == "red"){
x.bgColor = "green";
} else {
x.bgColor = "red";
}
}
</script>

</body>

</html>

No comments:

Post a Comment