Click here to Skip to main content
15,915,703 members
Home / Discussions / JavaScript
   

JavaScript

 
AnswerRe: Measuring how many li are in a ul that are visible in a horizontal sliding row of items Pin
Nathan Minier12-Aug-16 1:39
professionalNathan Minier12-Aug-16 1:39 
GeneralRe: Measuring how many li are in a ul that are visible in a horizontal sliding row of items Pin
jkirkerx12-Aug-16 6:44
professionaljkirkerx12-Aug-16 6:44 
QuestionHow to create array from existing array Pin
Member 126783159-Aug-16 17:00
Member 126783159-Aug-16 17:00 
AnswerRe: How to create array from existing array Pin
Richard MacCutchan9-Aug-16 21:06
mveRichard MacCutchan9-Aug-16 21:06 
AnswerRe: How to create array from existing array Pin
Karthik_Mahalingam20-Aug-16 18:26
professionalKarthik_Mahalingam20-Aug-16 18:26 
QuestionJS Object Remove Duplicates Pin
Member 126766088-Aug-16 19:49
Member 126766088-Aug-16 19:49 
AnswerRe: JS Object Remove Duplicates Pin
W Balboos, GHB9-Aug-16 5:06
W Balboos, GHB9-Aug-16 5:06 
AnswerRe: JS Object Remove Duplicates Pin
Beginner Luck14-Aug-16 19:59
professionalBeginner Luck14-Aug-16 19:59 
QuestionAdd query columns to output (see code) Pin
Stavros McGillicuddy7-Aug-16 11:15
Stavros McGillicuddy7-Aug-16 11:15 
AnswerRe: Add query columns to output (see code) Pin
Nathan Minier8-Aug-16 1:30
professionalNathan Minier8-Aug-16 1:30 
QuestionUnexpected Identifier error Pin
Stavros McGillicuddy6-Aug-16 11:02
Stavros McGillicuddy6-Aug-16 11:02 
QuestionRe: Unexpected Identifier error Pin
Richard Deeming8-Aug-16 1:38
mveRichard Deeming8-Aug-16 1:38 
Questionchange in cell content of salary or bonus or deduction in table cells automatically affect in total Pin
ahmed_sa30-Jul-16 6:39
ahmed_sa30-Jul-16 6:39 
Hi i have table have 5 comnun
Name Salary Bonus Deduction Total
Ahmed 500 500 100 900
calculation of total is
Total=Salary+Bonus-Deduction
and total in red color according to my code
what i need actually if i changed in Salary cell or Bonus cell or Deduction cell affect in total cell
suppose i added row above then edit salary
from 500 to 2000 meaning in this time row will be as bellow
Ahmed 2000 500 100 2400
total will be 2400 with green color
i can do by button but how to do by changing cell in table affect in total


@{
Layout = null;
}



<html>
<head>
<meta name="viewport" content="width=device-width" />
<title>Index</title>
<script src="~/Scripts/jquery-1.10.2.js"></script>
<script>
$(function () {
$("#btn").click(function () {
var x = $("#txt1").val();
var y = $("#txt2").val();
var z = $("#txt3").val();
var M = $("#txt4").val();
var L = parseInt(y) + parseInt(z) - parseInt(M);

$("#tb").append(" " + x + " " + y + " " + z + "" + M + "" + L + "");
$("#tb tr").each(function () {
var total = $(this).find("td:nth-child(5)").html();

if(parseInt(total)>1000)
{
$(this).find("td:nth-child(5)").css("background-color", "green");
}
if (parseInt(total) < 1000) {
$(this).find("td:nth-child(5)").css("background-color", "red");
}
if (parseInt(total) == 1000) {
$(this).find("td:nth-child(5)").css("background-color", "yellow");
}

});


});


$("#tb").on("click", "tr", function () {

$(this).find("td").slice(0, 4).prop("contenteditable", true);

});



});
</script>

.red{
color:#ff0000;
font-weight:bold;
}



</head>
<body>

Name<input type="text" id="txt1" />

Salary<input type="text" id="txt2" />

Bonus<input type="text" id="txt3" />

Deduction<input type="text" id="txt4" />

<input type="button" value="add" id="btn" />




Name



Salary



Bonus



Deduction


total


</body>
</html>
Questionget the value of row before changing in table if cancel click Pin
ahmed_sa25-Jul-16 7:13
ahmed_sa25-Jul-16 7:13 
QuestionCode is not working correctly Pin
Member 1265075924-Jul-16 2:31
Member 1265075924-Jul-16 2:31 
SuggestionRe: Code is not working correctly Pin
Richard MacCutchan24-Jul-16 2:48
mveRichard MacCutchan24-Jul-16 2:48 
AnswerRe: Code is not working correctly Pin
John C Rayan27-Jul-16 22:20
professionalJohn C Rayan27-Jul-16 22:20 
Questionneed help understanding how regular updating of a div works Pin
Member 1263409813-Jul-16 16:55
Member 1263409813-Jul-16 16:55 
AnswerRe: need help understanding how regular updating of a div works Pin
John C Rayan15-Jul-16 0:12
professionalJohn C Rayan15-Jul-16 0:12 
AnswerRe: need help understanding how regular updating of a div works Pin
ZurdoDev15-Jul-16 2:26
professionalZurdoDev15-Jul-16 2:26 
QuestionNeed help understanding this piece of code Pin
Jaime Premy10-Jul-16 5:53
professionalJaime Premy10-Jul-16 5:53 
AnswerRe: Need help understanding this piece of code Pin
ZurdoDev15-Jul-16 2:31
professionalZurdoDev15-Jul-16 2:31 
GeneralRe: Need help understanding this piece of code Pin
Jaime Premy15-Jul-16 5:21
professionalJaime Premy15-Jul-16 5:21 
GeneralRe: Need help understanding this piece of code Pin
ZurdoDev15-Jul-16 5:26
professionalZurdoDev15-Jul-16 5:26 
GeneralRe: Need help understanding this piece of code Pin
Jaime Premy16-Jul-16 18:22
professionalJaime Premy16-Jul-16 18:22 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.