- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 10878 Articles for Web Development
533 Views
In this tutorial, we will learn how to invoke a JavaScript Function with the 'new' Function Constructor. Functions are a set of reusable codes that perform a specific task and may return a value. In JavaScript, functions are defined by the keyword function. A function may not have any parameters and may also not have any return statement. In JavaScript, we also have functions with no function names, called anonymous functions Using the 'new' Function Constructor The Function constructor makes a new Function object. By using the constructor, we can create a function dynamically. It takes parameters, or arguments, and ... Read More
779 Views
JavaScript allows us to write our own functions as well. To invoke a function somewhere later in the script, you would simply need to write the name of that function.ExampleYou can try to run the following code to learn how to call a function in JavaScript − function sayHello() { document.write ("Hello there!"); } Click the following button to call the function Use different text in write method and then try...
1K+ Views
To call a function on click of a button in JavaScript, use onclick. Try to run the following code to call a function onclick in JavaScript −Example function sayHello() { document.write ("Hello there!"); } Click the following button to call the function Use different text in write method and then try...
2K+ Views
In this tutorial, we will learn complex data types in JavaScript. JavaScript has multiple built-in data types to store data in different formats. The data types of JavaScript can be divided into two groups, and those are primitive data types and non-primitive data types. Number, String, Boolean, Undefined and Null are part of the primitive data type, whereas the Array and Object are part of the non-primitive data type. The typeof operator is used to identify the data types. The primitive data types are simple and easy to use. In contrast, the non-primitive data types (Array and Object) are relatively ... Read More
124 Views
JavaScript also has dynamic types. That would mean the same variable used for holding different data types in JavaScript.Example var val; val = "Amit"; document.write("String: "+val); val = 20; document.write("Number: "+val); val = 40.90; document.write("Number with decimals: "+val);
3K+ Views
The onsubmit event is an event that occurs when you try to submit a form. You can put your form validation against this event type. The following example shows how to use onsubmit. Here we are calling a validate() function before submitting a form data to the web server. If validate() function returns true, the form will be submitted, otherwise, it'll not submit the data.ExampleThe following example is a code snippet showing the usage of the onsubmit event − .......