WAP To Changing The Content of Windows
WAP To Changing The Content of Windows
<html><head>
</head><body>
<script>
function changeContent() {
</script></body></html>
<html><head>
<title>Event Demonstration</title>
</head><body>
onclick="handleClick()"
onmousedown="handleMouseDown()">
<script>
function handleClick() {
document.write('<p>Button clicked!</p>'); }
function handleMouseDown() {
} </script> </body></html>
The `splice` method in JavaScript is used to add or remove items from an array.
- start: The index at which to start changing the array. If `start` is greater than the array length, itwill start at the end of the array. -
deleteCount : The number of elements to remove from the array. If omitted, all elements from`start` to the end of the array will be
removed. - `item1, item2, …`: Elements to add to the array, starting at the `start` index. If no elements areprovided, only elements will be
removed.Examples: 1. Removing Elements:
```javascript
Explanation: This adds `’Cherry’` and `’Fig’` without removing any elements.
elements
Explanation: This removes `’Banana’` and `’Cherry’`, and adds `’Blueberry’` and `’Mango’` in their Place.
*Example:
var person = new Object(); person.firstName = "Swati"; person.lastName = "Jain"; person.age = 10;
emp.id="CP-110";
emp.name="John Dias";
emp.salary=50000;
</script>
</body>
<script>
Var person = 1
This.firstName = words[0];
This.firstName = words[0].toUpperCase();
This.lastName = words[1];
} Document.write(person.fullName); //Getters and setters allow you to get and set properties via methods.
Document.writeln(person.firstName); // Yash
Document.write(person.lastName); // Desai
</script>
•The radiobutton allows the user to choose one of a predefined set of optionsANS= Define groups with the na property of the radio
buttons. Radio buttons with the same name belong to the same group. Radio buttons different names belongs to the different groups.
At most one radio button ca checked in group.
Syntax:
Code
<html> <body>
<fieldset>
<legend>Select Course:</legend>
<br>
</fieldset>
</form>
<script type=”text/javascript”>
Function ValidateForm()
If(obj[i].checked == true)
Return true;
Else
Return false;
}</script>. </body>