java doubts
java doubts
1 Write a Java script to modify the status bar using on MouseOver and on
MouseOut with links.When the user moves his mouse over the link, it will
display “MSBTE” in the status bar. When theuser moves his mouse away from
the link the status bar will display nothing.
<!DOCTYPE html>
<html>
<body>
<a
href="#"
>
</a>
</body>
</html>
Q.8 Write HTML code to design a form that displays textboxes for accepting UserID and Aadhar No. and a
SUBMIT button. UserID should contain 10 alphanumeric characters and must start with Capital Letter. Aadhar
No. should contain 12 digits in the format nnnn nnnn nnnn. Write JavaScript code to validate the UserID and
Aadhar No. when the user clicks on SUBMIT button.
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<h1>Form Validation</h1>
<form>
</form>
<script>
function validateForm() {
if (!userID.match(userIDPattern)) {
capital letter.");
return;
if (!aadharNo.match(aadharPattern)) {
return;
}
alert("Form submitted successfully!");
</script>
</body>
</html>
Q9. Aadhaar Number: Write a webpage that accepts Username and adharcard as input texts.
When the user enters adhaarcard number ,the JavaScript validates card number and diplays
whether card number is valid or not. (Assume valid adhaar card format to be
nnnn.nnnn.nnnn or nnnn-nnnn-nnnn)
<hr/>
<script type="text/javascript">
function ValidateAadhaar() {
lblError.innerHTML = "";
if (!expr.test(aadhaar)) {
</script>
When the Submit Button is clicked, the ValidateAadhaar JavaScript function is executed.
Inside the ValidateAadhaar JavaScript function, the Aadhaar Number TextBox is referenced and its value is tested using
a Regular Expression.
2. White space after every 4th digit. Ex: 1234 5678 9012
<script type="text/javascript">
function ValidateAadhaar() {
lblError.innerHTML = "";
if (!expr.test(aadhaar)) {
</script>
CSS Class
<style type="text/css">
</style>
10 a. Write HTML Script that displays textboxes for accepting Name, middlename, Surname of the user and a
Submit button. Write proper JavaScript such that when the user clicks on submit button i) all texboxes must get
disabled and change the color to “RED”. and with respective labels. 3 ii) Constructs the mailID as [email protected]
and displays mail ID as message. (Ex. If user enters Rajni as name and Pathak as surname mailID will be
constructed.com) as rajni.pathak@msbte. -->
<!DOCTYPE html>
<html>
<body>
<h3>User Information</h3>
<button onclick="submitForm()">Submit</button>
<p id="emailMessage"></p>
<script>
function submitForm() {
"@msbte.com";
document.getElementById("emailMessage").innerText =
document.getElementById("firstName").disabled = true;
document.getElementById("middleName").disabled = true;
document.getElementById("lastName").disabled = true;
document.getElementById("firstName").style.backgroundColor = "red";
document.getElementById("middleName").style.backgroundColor;
document.getElementById("firstName").style.color = "white";
document.getElementById("middleName").style.color = "white";
document.getElementById("lastName").style.color = "white";
</script>
</body>
</html>
Q.12 Create a slideshow with the group of four images, also simulate the next and previous
transition between slides in your JavaScript.
<!DOCTYPE html>
<html>
<head>
<title>Simple Slideshow</title>
</head>
<body>
<h1>Image Slideshow</h1>
<div>
<img id="slideImage"
</div>
<div>
<button onclick="previousSlide()">Previous</button>
<button onclick="nextSlide()">Next</button>
</div>
<script>
const images = [
"IMG_20240605_165349_638.jpg",
"IMG_20240605_165349_676.jpg",
"https://www.gstatic.com/webp/gallery/1.png",
"https://www.gstatic.com/webp/gallery/4.png"
];
let current = 0;
function showSlide() {
document.getElementById("slideImage").src = images[current];
}
function nextSlide() {
showSlide();
function previousSlide() {
showSlide();
showSlide();
</script>
</body>
</html>