Feed-Back Details: CTS CSD JS Mandatory Hands-on 3
Feed-Back Details: CTS CSD JS Mandatory Hands-on 3
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<title></title>
</head>
<body>
<h2>Feedback for the ART OF LIVING session</h2>
<table>
<tr>
<td>Enter the Feedback:</td>
<td><textarea name="feedback" id=feedback rows="4" cols="40"></textarea></td>
</tr>
<tr>
<td colspan="2"><input type="button" name="create" id="create" value="Add Feedback" onclick="addFeedback();" /></td>
</tr>
<tr>
<td colspan="2"><input type="button" name="view" id="view" value="View Feedback" onclick="displayFeedback();" /></td>
</tr>
</table>
<div id="result"></div>
<script src="script.js" type="text/javascript"></script>
</body>
</html>
script.js
var arr = [];
function addFeedback(){
var feedbackTextArea = document.getElementById("feedback");
arr.push(feedbackTextArea.value);
feedbackTextArea.value = " ";
result.innerHTML = "<h2>Feedback Details</h2><br>Successfully Added Feedback Details!";
}
function displayFeedback(){
var count=1;
var op ="<h2>Feedback Details</h2>";
for(var index in arr){
op = op+"Feedback "+(count++)+"<br>"+arr[index]+"<br>";
}
document.getElementById("result").innerHTML=op;
}
Thank you..
ReplyDelete