Notes for You:: JavaScript Events with return value - JavaScript Tutorial 109
Example 1:
<a href="https://www.google.com" onclick="return DisplayConfirmBox()">Google</a>
<script type="text/javascript">
function DisplayConfirmBox()
{
return confirm("Are you sure; you want to visit google.com?");
}
</script>
Example 2:
default.html code
<form action="processor.html" onsubmit="return validate()">
<label>User Name:</label>
<input type="text" name="txtUserName" id="txtUserName" value=""/>
<span id="errorMessage"></span><br/>
<input type="submit"/>
</form>
<script type="text/javascript">
function validate()
{
var txtUserName = document.getElementById("txtUserName");
var errorMessage = document.getElementById("errorMessage");
if(txtUserName.value != "")
{
return true;
}
else
{
errorMessage.innerHTML = "*";
errorMessage.style.color = "red";
return false;
}
}
</script>
processor.html code
<script type="text/javascript">
var urlSearchParams = new URLSearchParams(window.location.search);
alert("Welcome:" + urlSearchParams.get("txtUserName"));
</script>
Note:
replace < with less-than symbol.
replace > with greater-than symbol.
=========================================
Follow the link for next video:
JavaScript setTimeout() Function - JavaScript Tutorial 110
• JavaScript setTimeout() function - Ja...
Follow the link for previous video:
How to Get Current HTML Element in JavaScript - JavaScript Tutorial 108
• How to Get current HTML Element in Ja...
=========================================
JavaScript Tutorials Playlist:-
• JavaScript Tutorials
=========================================
Watch My Other Useful Tutorials:-
jQuery Tutorials Playlist:-
• jQuery Tutorials
jQuery UI Tutorials Playlist:-
• jQuery UI Tutorials
Bootstrap Tutorials Playlist:-
• Bootstrap4 Tutorials
=========================================
► Subscribe to our YouTube channel:
/ chidrestechtutorials
► Visit our Website:
https://www.chidrestechtutorials.com
=========================================
Hash Tags:-
#ChidresTechTutorials #JavaScript #JavaScriptTutorial
On this page of the site you can watch the video online JavaScript Events with return value - JavaScript Tutorial 109 with a duration of hours minute second in good quality, which was uploaded by the user ChidresTechTutorials 05 May 2023, share the link with friends and acquaintances, this video has already been watched 482 times on youtube and it was liked by 15 viewers. Enjoy your viewing!