Found 10711 Articles for Web Development

How to provide new line in JavaScript alert box?

Rishi Rathor
Updated on 08-Jan-2020 10:38:08

544 Views

To add a new line in JavaScript alert box, use the “”:alert("Line One Line Two");ExampleYou can try to run the following code add a new line in an alert box in JavaScript:Live Demo                                         Click the following button to see the result:                          

How to call a JavaScript function from an onmouseout event?

Sreemaha
Updated on 08-Jan-2020 10:37:23

253 Views

The onmouseout triggers when you move your mouse out from that element.ExampleYou can try to run the following example to learn how to call a JavaScript function from onmouseout eventLive Demo                                         Bring your mouse inside the division to see the result:                 This is inside the division          

How to call a JavaScript function from an onmouseover event?

varma
Updated on 08-Jan-2020 10:36:14

1K+ Views

The onmouseover event triggers when you bring your mouse over any element.ExampleYou can try to run the following example to learn how to call a JavaScript function from onmouseover eventLive Demo                                         Bring your mouse inside the division to see the result:                 This is inside the division          

How to call a JavaScript function from an onsubmit event?

usharani
Updated on 16-Jun-2020 11:37:14

2K+ Views

The onsubmit event 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 webserver. If validate() function returns true, the form will be submitted, otherwise it will not submit the data.     The HTML    .......    

How to show prompt dialog box using JavaScript?

Nancy Den
Updated on 08-Jan-2020 10:34:24

413 Views

The prompt dialog box is very useful when you want to pop-up a text box to get user input. Thus, it enables you to interact with the user. The user needs to fill in the field and then click OK.This dialog box is displayed using a method called prompt() which takes two parameters: (i) a label which you want to display in the text box and (ii) a default string to display in the text box.This dialog box has two buttons: OK and Cancel. If the user clicks the OK button, the window method prompt() will return the entered value ... Read More

How do you get a timestamp in JavaScript?

Shubham Vora
Updated on 25-Jul-2022 08:39:25

5K+ Views

In this tutorial, we will learn to get a timestamp in JavaScript. It never happens that software developers or application developers don’t require to play with date and time. In many situations, they are required to play with date and timestamp. For example, to show the time on the user’s dashboard, save the time of an operation in the database.Now, let’s understand what the timestamp is? The timestamp is the total number of milliseconds from the 1st January 1970 from when UNIX epochs begin. Using the timestamp, we can extract the date, day, year, month, hours, minutes, second, milliseconds, etc.So, ... Read More

How to use JavaScript to show a confirm message?

Abhishek Kumar
Updated on 10-Nov-2022 08:21:44

6K+ Views

In this tutorial, we will learn how to use JavaScript to show a confirm message. We use window.confirm() method of JavaScript to show a confirm message. A confirm message is enclosed in a confirm dialog box which is a modal window. Such a window takes focus upon being created and doesn’t go out of focus until the user responds to it. Confirmation dialog box in JavaScript A confirm message is a yes/no message for the user that requires immediate attention. A confirmation dialog box usually gets triggered in response to some action requested by the user. This action can be ... Read More

How to call a JavaScript function from an onClick event?

varun
Updated on 08-Jan-2020 10:32:26

1K+ Views

The onClick event is the most frequently used event type, which occurs when a user clicks the left button of the mouse. You can put your validation, warning etc., against this event type.ExampleYou can try to run the following code to call a JavaScript function from an onClick eventLive Demo                                         Click the following button and see result                          

What is the lifetime of JavaScript variables?

Govinda Sai
Updated on 15-Jun-2020 12:14:35

813 Views

The lifetime of a JavaScript variable begins when it is declared −var rank;A local variable will be visible only within a function where it is defined. Function parameters are always local to that function.The completion of a function deletes the local variable.A global variable has a global scope which means it can be defined anywhere in your JavaScript code. Global variables delete when the web browser is closed. However if a new page is loaded in the same browser window, then it remains.Here’s the usage of global variables −ExampleYou can try to run the following code to learn how to ... Read More

What are event handlers in JavaScript?

seetha
Updated on 03-Oct-2019 06:24:02

521 Views

JavaScript's interaction with HTML is handled through events that occur when the user or the browser manipulates a page.When the page loads, it is called an event. When the user clicks a button, that click to is an event. Other examples include events like pressing any key, closing a window, resizing a window, etc.Here are some examples:onclick Event TypeThis is the most frequently used event type, which occurs when a user clicks the left button of his mouse. You can put your validation, warning etc., against this event type.Try the following example.Live Demo               ... Read More

Advertisements