Plugins:
<link href="Content/bootstrap.min.css" rel="stylesheet" />
<script src="Scripts/jquery-1.9.1.min.js"></script>
<script src="Scripts/bootstrap.min.js"></script>
HTML:
asp.net- .aspx page
<form id="form1" runat="server">
<asp:HiddenField ID="boxId" runat="server" />
<asp:HiddenField ID="boxValue" runat="server" />
<div class="textOne">
Profitiblity and productivity
</div>
<div class="boxArea">
<%--start--%>
<div class="number">
10
</div>
<div id="TenOne" class="box item" onmouseover="mouseoverColor(this)" onmousedown="mousedownColor(this)">
</div>
<div id="TenTwo" class="box item" onmouseover="mouseoverColor(this)" onmousedown="mousedownColor(this)">
</div>
<div id="TenThree" class="box item" onmouseover="mouseoverColor(this)" onmousedown="mousedownColor(this)">
</div>
<div id="TenFour" class="box item" onmouseover="mouseoverColor(this)" onmousedown="mousedownColor(this)">
</div>
<div id="TenFive" class="box item" onmouseover="mouseoverColor(this)" onmousedown="mousedownColor(this)">
</div>
<div id="TenSix" class="box item" onmouseover="mouseoverColor(this)" onmousedown="mousedownColor(this)">
</div>
<div id="TenSeven" class="box item" onmouseover="mouseoverColor(this)" onmousedown="mousedownColor(this)">
</div>
<div id="TenEight" class="box item" onmouseover="mouseoverColor(this)" onmousedown="mousedownColor(this)">
</div>
<div id="TenNine" class="box item" onmouseover="mouseoverColor(this)" onmousedown="mousedownColor(this)">
</div>
<div id="TenTen" class="boxR item" onmouseover="mouseoverColor(this)" onmousedown="mousedownColor(this)">
</div>
<%--end--%>
<%--start--%>
<div class="number">
09
</div>
<div id="NineOne" class="box item" onmouseover="mouseoverColor(this)" onmousedown="mousedownColor(this)">
</div>
<div id="NineTwo" class="box item" onmouseover="mouseoverColor(this)" onmousedown="mousedownColor(this)">
</div>
<div id="NineThree" class="box item" onmouseover="mouseoverColor(this)" onmousedown="mousedownColor(this)">
</div>
<div id="NineFour" class="box item" onmouseover="mouseoverColor(this)" onmousedown="mousedownColor(this)">
</div>
<div id="NineFive" class="box item" onmouseover="mouseoverColor(this)" onmousedown="mousedownColor(this)">
</div>
<div id="NineSix" class="box item" onmouseover="mouseoverColor(this)" onmousedown="mousedownColor(this)">
</div>
<div id="NineSeven" class="box item" onmouseover="mouseoverColor(this)" onmousedown="mousedownColor(this)">
</div>
<div id="NineEight" class="box item" onmouseover="mouseoverColor(this)" onmousedown="mousedownColor(this)">
</div>
<div id="NineNine" class="box item" onmouseover="mouseoverColor(this)" onmousedown="mousedownColor(this)">
</div>
<div id="NineTen" class="boxR item" onmouseover="mouseoverColor(this)" onmousedown="mousedownColor(this)">
</div>
<%--end--%>
<%--start--%>
<div class="number">
08
</div>
<div id="EightOne" class="box item" onmouseover="mouseoverColor(this)" onmousedown="mousedownColor(this)">
</div>
<div id="EightTwo" class="box item" onmouseover="mouseoverColor(this)" onmousedown="mousedownColor(this)">
</div>
<div id="EightThree" class="box item" onmouseover="mouseoverColor(this)" onmousedown="mousedownColor(this)">
</div>
<div id="EightFour" class="box item" onmouseover="mouseoverColor(this)" onmousedown="mousedownColor(this)">
</div>
<div id="EightFive" class="box item" onmouseover="mouseoverColor(this)" onmousedown="mousedownColor(this)">
</div>
<div id="EightSix" class="box item" onmouseover="mouseoverColor(this)" onmousedown="mousedownColor(this)">
</div>
<div id="EightSeven" class="box item" onmouseover="mouseoverColor(this)" onmousedown="mousedownColor(this)">
</div>
<div id="EightEight" class="box item" onmouseover="mouseoverColor(this)" onmousedown="mousedownColor(this)">
</div>
<div id="EightNine" class="box item" onmouseover="mouseoverColor(this)" onmousedown="mousedownColor(this)">
</div>
<div id="EightTen" class="boxR item" onmouseover="mouseoverColor(this)" onmousedown="mousedownColor(this)">
</div>
<%--end--%>
<%--start--%>
<div class="number">
07
</div>
<div id="SevenOne" class="box item" onmouseover="mouseoverColor(this)" onmousedown="mousedownColor(this)">
</div>
<div id="SevenTwo" class="box item" onmouseover="mouseoverColor(this)" onmousedown="mousedownColor(this)">
</div>
<div id="SevenThree" class="box item" onmouseover="mouseoverColor(this)" onmousedown="mousedownColor(this)">
</div>
<div id="SevenFour" class="box item" onmouseover="mouseoverColor(this)" onmousedown="mousedownColor(this)">
</div>
<div id="SevenFive" class="box item" onmouseover="mouseoverColor(this)" onmousedown="mousedownColor(this)">
</div>
<div id="SevenSix" class="box item" onmouseover="mouseoverColor(this)" onmousedown="mousedownColor(this)">
</div>
<div id="SevenSeven" class="box item" onmouseover="mouseoverColor(this)" onmousedown="mousedownColor(this)">
</div>
<div id="SevenEight" class="box item" onmouseover="mouseoverColor(this)" onmousedown="mousedownColor(this)">
</div>
<div id="SevenNine" class="box item" onmouseover="mouseoverColor(this)" onmousedown="mousedownColor(this)">
</div>
<div id="SevenTen" class="boxR item" onmouseover="mouseoverColor(this)" onmousedown="mousedownColor(this)">
</div>
<%--end--%>
<%--start--%>
<div class="number">
06
</div>
<div id="SixOne" class="box item" onmouseover="mouseoverColor(this)" onmousedown="mousedownColor(this)">
</div>
<div id="SixTwo" class="box item" onmouseover="mouseoverColor(this)" onmousedown="mousedownColor(this)">
</div>
<div id="SixThree" class="box item" onmouseover="mouseoverColor(this)" onmousedown="mousedownColor(this)">
</div>
<div id="SixFour" class="box item" onmouseover="mouseoverColor(this)" onmousedown="mousedownColor(this)">
</div>
<div id="SixFive" class="box item" onmouseover="mouseoverColor(this)" onmousedown="mousedownColor(this)">
</div>
<div id="SixSix" class="box item" onmouseover="mouseoverColor(this)" onmousedown="mousedownColor(this)">
</div>
<div id="SixSeven" class="box item" onmouseover="mouseoverColor(this)" onmousedown="mousedownColor(this)">
</div>
<div id="SixEight" class="box item" onmouseover="mouseoverColor(this)" onmousedown="mousedownColor(this)">
</div>
<div id="SixNine" class="box item" onmouseover="mouseoverColor(this)" onmousedown="mousedownColor(this)">
</div>
<div id="SixTen" class="boxR item" onmouseover="mouseoverColor(this)" onmousedown="mousedownColor(this)">
</div>
<%--end--%>
<%--start--%>
<div class="number">
05
</div>
<div id="FiveOne" class="box item" onmouseover="mouseoverColor(this)" onmousedown="mousedownColor(this)">
</div>
<div id="FiveTwo" class="box item" onmouseover="mouseoverColor(this)" onmousedown="mousedownColor(this)">
</div>
<div id="FiveThree" class="box item" onmouseover="mouseoverColor(this)" onmousedown="mousedownColor(this)">
</div>
<div id="FiveFour" class="box item" onmouseover="mouseoverColor(this)" onmousedown="mousedownColor(this)">
</div>
<div id="FiveFive" class="box item" onmouseover="mouseoverColor(this)" onmousedown="mousedownColor(this)">
</div>
<div id="FiveSix" class="box item" onmouseover="mouseoverColor(this)" onmousedown="mousedownColor(this)">
</div>
<div id="FiveSeven" class="box item" onmouseover="mouseoverColor(this)" onmousedown="mousedownColor(this)">
</div>
<div id="FiveEight" class="box item" onmouseover="mouseoverColor(this)" onmousedown="mousedownColor(this)">
</div>
<div id="FiveNine" class="box item" onmouseover="mouseoverColor(this)" onmousedown="mousedownColor(this)">
</div>
<div id="FiveTen" class="boxR item" onmouseover="mouseoverColor(this)" onmousedown="mousedownColor(this)">
</div>
<%--end--%>
<%--start--%>
<div class="number">
04
</div>
<div id="FourOne" class="box item" onmouseover="mouseoverColor(this)" onmousedown="mousedownColor(this)">
</div>
<div id="FourTwo" class="box item" onmouseover="mouseoverColor(this)" onmousedown="mousedownColor(this)">
</div>
<div id="FourThree" class="box item" onmouseover="mouseoverColor(this)" onmousedown="mousedownColor(this)">
</div>
<div id="FourFour" class="box item" onmouseover="mouseoverColor(this)" onmousedown="mousedownColor(this)">
</div>
<div id="FourFive" class="box item" onmouseover="mouseoverColor(this)" onmousedown="mousedownColor(this)">
</div>
<div id="FourSix" class="box item" onmouseover="mouseoverColor(this)" onmousedown="mousedownColor(this)">
</div>
<div id="FourSeven" class="box item" onmouseover="mouseoverColor(this)" onmousedown="mousedownColor(this)">
</div>
<div id="FourEight" class="box item" onmouseover="mouseoverColor(this)" onmousedown="mousedownColor(this)">
</div>
<div id="FourNine" class="box item" onmouseover="mouseoverColor(this)" onmousedown="mousedownColor(this)">
</div>
<div id="FourTen" class="boxR item" onmouseover="mouseoverColor(this)" onmousedown="mousedownColor(this)">
</div>
<%--end--%>
<%--start--%>
<div class="number">
03
</div>
<div id="ThreeOne" class="box item" onmouseover="mouseoverColor(this)" onmousedown="mousedownColor(this)">
</div>
<div id="ThreeTwo" class="box item" onmouseover="mouseoverColor(this)" onmousedown="mousedownColor(this)">
</div>
<div id="ThreeThree" class="box item" onmouseover="mouseoverColor(this)" onmousedown="mousedownColor(this)">
</div>
<div id="ThreeFour" class="box item" onmouseover="mouseoverColor(this)" onmousedown="mousedownColor(this)">
</div>
<div id="ThreeFive" class="box item" onmouseover="mouseoverColor(this)" onmousedown="mousedownColor(this)">
</div>
<div id="ThreeSix" class="box item" onmouseover="mouseoverColor(this)" onmousedown="mousedownColor(this)">
</div>
<div id="ThreeSeven" class="box item" onmouseover="mouseoverColor(this)" onmousedown="mousedownColor(this)">
</div>
<div id="ThreeEight" class="box item" onmouseover="mouseoverColor(this)" onmousedown="mousedownColor(this)">
</div>
<div id="ThreeNine" class="box item" onmouseover="mouseoverColor(this)" onmousedown="mousedownColor(this)">
</div>
<div id="ThreeTen" class="boxR item" onmouseover="mouseoverColor(this)" onmousedown="mousedownColor(this)">
</div>
<%--end--%>
<%--start--%>
<div class="number">
02
</div>
<div id="TwoOne" class="box item" onmouseover="mouseoverColor(this)" onmousedown="mousedownColor(this)">
</div>
<div id="TwoTwo" class="box item" onmouseover="mouseoverColor(this)" onmousedown="mousedownColor(this)">
</div>
<div id="TwoThree" class="box item" onmouseover="mouseoverColor(this)" onmousedown="mousedownColor(this)">
</div>
<div id="TwoFour" class="box item" onmouseover="mouseoverColor(this)" onmousedown="mousedownColor(this)">
</div>
<div id="TwoFive" class="box item" onmouseover="mouseoverColor(this)" onmousedown="mousedownColor(this)">
</div>
<div id="TwoSix" class="box item" onmouseover="mouseoverColor(this)" onmousedown="mousedownColor(this)">
</div>
<div id="TwoSeven" class="box item" onmouseover="mouseoverColor(this)" onmousedown="mousedownColor(this)">
</div>
<div id="TwoEight" class="box item" onmouseover="mouseoverColor(this)" onmousedown="mousedownColor(this)">
</div>
<div id="TwoNine" class="box item" onmouseover="mouseoverColor(this)" onmousedown="mousedownColor(this)">
</div>
<div id="TwoTen" class="boxR item" onmouseover="mouseoverColor(this)" onmousedown="mousedownColor(this)">
</div>
<%--end--%>
<%--start--%>
<div class="number">
01
</div>
<div id="OneOne" class="boxB item" onmouseover="mouseoverColor(this)" onmousedown="mousedownColor(this)">
</div>
<div id="OneTwo" class="boxB item" onmouseover="mouseoverColor(this)" onmousedown="mousedownColor(this)">
</div>
<div id="OneThree" class="boxB item" onmouseover="mouseoverColor(this)" onmousedown="mousedownColor(this)">
</div>
<div id="OneFour" class="boxB item" onmouseover="mouseoverColor(this)" onmousedown="mousedownColor(this)">
</div>
<div id="OneFive" class="boxB item" onmouseover="mouseoverColor(this)" onmousedown="mousedownColor(this)">
</div>
<div id="OneSix" class="boxB item" onmouseover="mouseoverColor(this)" onmousedown="mousedownColor(this)">
</div>
<div id="OneSeven" class="boxB item" onmouseover="mouseoverColor(this)" onmousedown="mousedownColor(this)">
</div>
<div id="OneEight" class="boxB item" onmouseover="mouseoverColor(this)" onmousedown="mousedownColor(this)">
</div>
<div id="OneNine" class="boxB item" onmouseover="mouseoverColor(this)" onmousedown="mousedownColor(this)">
</div>
<div id="OneTen" class="boxRB item" onmouseover="mouseoverColor(this)" onmousedown="mousedownColor(this)">
</div>
<%--end--%>
<div class="number">
</div>
<div class="number">
01
</div>
<div class="number">
02
</div>
<div class="number">
03
</div>
<div class="number">
04
</div>
<div class="number">
05
</div>
<div class="number">
06
</div>
<div class="number">
07
</div>
<div class="number">
08
</div>
<div class="number">
09
</div>
<div class="number">
10
</div>
<div class="textTwo">
Time
</div>
</div>
<div class="highpriority" onclick="highpriority()">High</div><br /><br /><br /><br /><br />
<div class="mediumpriority" onclick="mediumpriority()">Medium</div><br /><br /><br />
<div class="lowpriority" onclick="lowpriority()">Low</div>
<asp:Button ID="Button1" runat="server" onclick="update_Click" OnClientClick="getColor()" Text="Button" />
</form>
asp.net- aspx.cs
protected void Page_Load(object sender, EventArgs e)
{
if (Session["box"] != null)
{
string boxId = Session["box"].ToString();
string boxValue = Session["value"].ToString();
ClientScript.RegisterStartupScript(this.GetType(), "colorLoad", "colorLoad('" + boxId + "','" + boxValue + "');", true);
}
}
protected void update_Click(object sender, EventArgs e)
{
string box = boxId.Value;
string value = boxValue.Value;
Session["box"] = box;
Session["value"] = value;
}
CSS:
<style>
body {
}
.boxArea {
border: 1px solid gray;
width: 575px;
height: 550px;
padding: 10px;
margin: 40px 35px;
float: left;
}
.textOne {
float: left;
max-height: 550px;
width: 167px;
margin: 220px 170px;
margin-left: -180px;
padding-top: 530px;
-webkit-transform: rotate(-90deg);
-moz-transform: rotate(-90deg);
-ms-transform: rotate(-90deg);
-o-transform: rotate(-90deg);
filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=3);
}
.textTwo {
}
.number {
width: 50px;
height: 50px;
text-align: center;
float: left;
padding-top: 14px;
}
.box {
width: 50px;
height: 50px;
border: 1px solid gray;
float: left;
border-bottom: none;
border-right: none;
}
.boxR {
width: 50px;
height: 50px;
border: 1px solid gray;
float: left;
border-bottom: none;
}
.boxB {
width: 50px;
height: 50px;
border: 1px solid gray;
float: left;
border-right: none;
}
.boxRB {
width: 50px;
height: 50px;
border: 1px solid gray;
float: left;
}
.box:hover, .boxR:hover, .boxB:hover, .boxRB:hover, .selectBox:hover {
cursor: pointer;
}
.selectBox {
background: #c3c1c1;
}
.selectBoxHigh {
background: red !important;
}
.selectBoxMedium {
background: yellow !important;
}
.selectBoxLow {
background: #4cff00 !important;
}
.highpriority {
width: 60px;
height: 50px;
border: 1px solid #ae0303;
background: red;
float: left;
margin: 40px 5px;
margin-bottom: 5px;
text-align: center;
padding-top: 14px;
color: #000;
}
.mediumpriority {
width: 60px;
height: 50px;
border: 1px solid #cccc06;
background: yellow;
float: left;
margin: 5px 5px;
text-align: center;
padding-top: 14px;
color: #000;
}
.lowpriority {
width: 60px;
height: 50px;
border: 1px solid #3dba08;
background: #4cff00;
float: left;
margin: 10px 5px;
text-align: center;
padding-top: 14px;
color: #000;
}
</style>
Javascript:
<script type="text/javascript">
function getColor() {
var cusid_ele = document.getElementsByClassName('item');
var id = '';
var boxVal = '';
for (var i = 0; i < cusid_ele.length; ++i) {
var item = cusid_ele[i];
id = id + item.id + ',';
if ($(item).hasClass("selectBoxHigh")) {
boxVal = boxVal + 'high,';
}
else if ($(item).hasClass("selectBoxMedium")) {
boxVal = boxVal + 'medium,';
}
else if ($(item).hasClass("selectBoxLow")) {
boxVal = boxVal + 'low,';
}
else {
boxVal = boxVal + 'none,';
}
}
document.getElementById("<%= boxId.ClientID %>").value = id;
document.getElementById("<%= boxValue.ClientID %>").value = boxVal;
}
function colorLoad(boxId, boxValue) {
var boxFields = boxId.split(',');
var valueFields = boxValue.split(',');
for (var i = 0; i < 100; i++) {
if (valueFields[i] == 'high') {
$('#' + boxFields[i]).addClass('selectBoxHigh');
}
if (valueFields[i] == 'medium') {
$('#' + boxFields[i]).addClass('selectBoxMedium');
}
if (valueFields[i] == 'low') {
$('#' + boxFields[i]).addClass('selectBoxLow');
}
if (valueFields[i] == 'none') {
$('#' + boxFields[i]).addClass('selectBox');
}
}
}
</script>
<script type="text/javascript">
var mousedown = 0;
$(document).mousedown(function (e) {
e.preventDefault();
mousedown = 1;
});
$(document).mouseup(function (e) {
e.preventDefault();
mousedown = 0;
});
function mouseoverColor(x) {
if (mousedown == 1) {
if ($(x).hasClass("selectBox")) {
$(x).removeClass('selectBox');
} else {
$(x).addClass('selectBox');
$(x).removeClass('selectBoxHigh');
$(x).removeClass('selectBoxMedium');
$(x).removeClass('selectBoxLow');
}
}
}
function mousedownColor(x) {
if ($(x).hasClass("selectBox")) {
$(x).removeClass('selectBox');
} else {
$(x).addClass('selectBox');
$(x).removeClass('selectBoxHigh');
$(x).removeClass('selectBoxMedium');
$(x).removeClass('selectBoxLow');
}
}
function highpriority() {
var cusid_ele = document.getElementsByClassName('item');
for (var i = 0; i < cusid_ele.length; ++i) {
var item = cusid_ele[i];
if ($(item).hasClass("selectBox")) {
$(item).addClass('selectBoxHigh');
$(item).removeClass('selectBox');
}
}
}
function mediumpriority() {
var cusid_ele = document.getElementsByClassName('item');
for (var i = 0; i < cusid_ele.length; ++i) {
var item = cusid_ele[i];
if ($(item).hasClass("selectBox")) {
$(item).addClass('selectBoxMedium');
$(item).removeClass('selectBox');
}
}
}
function lowpriority() {
var cusid_ele = document.getElementsByClassName('item');
for (var i = 0; i < cusid_ele.length; ++i) {
var item = cusid_ele[i];
if ($(item).hasClass("selectBox")) {
$(item).addClass('selectBoxLow');
$(item).removeClass('selectBox');
}
}
}
</script>
Just copy and paste............ Enjoy.......
No comments:
Post a Comment