Advance Client-Server Technology: Lab File
Advance Client-Server Technology: Lab File
CLIENT-
SERVER
TECHNOLOGY
LAB FILE
Submitted By:
Sameer Mathur
IT-2149-2K14
INDEX
S.No. Program Name Signature
11. Write a program to prompt the user to enter the current day and display
whether it is a weekend or a weekday
12. Write a program to ask a question from the user and accept an answer. The
user is given three chances. If the user fails three times, an alert displaying
wrong answer is shown on the screen
14. Write a program to check whether text boxes in the form are empty. If it is
so, display an alert showing their name.
16. Write a program to read the current date and display in the given format.
17. Write a program to create a multiple choice list in JavaScript and display the
item(s) selected in the text area on the click of the button
<!DOCTYPE html>
<html>
<script>
function myfunc()
day = day.toLowerCase();
document.getElementById("daydisplay").innerHTML = "Weekend";
else
document.getElementById("daydisplay").innerHTML = "Weekday";
</script>
<body onload=myfunc()>
<p id="daydisplay"></p>
</body>
</html>
Q12
<!DOCTYPE html>
<html>
<script>
function ques()
var flag = 0;
for(i=0;i<3;i++)
if(ans == 9)
flag = 1;
break;
if(flag==0)
alert("Wrong answer");
</script>
<body onload=ques()>
</body>
</html>
Q13
<!DOCTYPE html>
<html>
<script>
function count()
</script>
<body onload=count()>
<form id = "form1">
</form>
</body>
</html>
Q14
<!DOCTYPE html>
<html>
<script>
function check()
var empty="";
for(i=0;i<inputs.length;i++)
if(inputs[i].getAttribute('type')=='text')
if(inputs[i].value=="")
</script>
<body>
<form id = "form1">
</form>
</body>
</html>
Q15
<!DOCTYPE html>
<html>
<script>
function calc()
var opn;
var n1 = parseFloat(document.getElementById("tb1").value);
var n2 = parseFloat(document.getElementById("tb2").value);
var n3 = document.getElementById("tb3");
for(i=0;i<inputs.length;i++)
if(inputs[i].getAttribute('type')=='radio')
if(inputs[i].checked==true)
opn=inputs[i].value;
if(opn=="add")
n3.value = n1 + n2;
else if(opn=="subtract")
n3.value = n1 - n2;
else if(opn=="multiply")
n3.value = n1 * n2;
else if(opn=="divide")
n3.value = n1 / n2;
}
</script>
<body>
<form id = "form1">
</form>
</body>
</html>
Program 16.
Write a program to read the current date and display in the given format.
<!DOCTYPE html>
<html>
<script type="text/JavaScript">
function getDate(){
var dd=today.getDate();
var mm=today.getMonth()+1;
var yyyy=today.getFullYear();
if(dd<10){
dd='0'+dd;
if(mm<10){
mm='0'+mm;
today=mm+'-'+dd+'-'+yyyy;
document.write(today);
document.write("<br>");
today = mm+'/'+dd+'/'+yyyy;
document.write(today);
document.write("<br>");
today = dd+'-'+mm+'-'+yyyy;
document.write(today);
document.write("<br>");
today = dd+'/'+mm+'/'+yyyy;
document.write(today);
</script>
<body>
</body>
</html>
Program 17.
Write a program to create a multiple choice list in JavaScript and display the
item(s) selected in the text area on the click of the button
<html>
<head>
<script type="text/javascript">
function getSelectValues(select) {
var opt;
opt = options[i];
if (opt.selected) {
result.push(opt.value || opt.text);
return result;
</script>
</head>
<body>
<option value="Windows">Windows
<option value="MacOS">MacOS
<option value="Debian">Debian
</select>
<br><br>
<button onclick="
var el = document.getElementsByTagName('select')[0];
alert(getSelectValues(el));
</body>
</html>
Program 18.
import java.sql.*;
class Query1 {
import java.sql.*;
conn = DriverManager.getConnection("jdbc:oracle:thin:@training:1521:
Oracle", "oratest", "oratest");