Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
Javascript Articles
Page 519 of 534
How to set src to the img tag in HTML from another domain?
To use an image on a webpage, use the tag. The tag allows you to add image source, alt, width, height, etc. The src is to add the image URL. The alt is the alternate text attribute, which is text that is visible when the image fails to load. With HTML, add the image source as another domain URL. For that, add the src attribute as a link to another domain. The following are the attributes: Sr.No. Attribute & Description 1 altThe alternate text for the image 2 heightThe height ...
Read MoreHow to set src to the img tag in html from the system drive?
To use an image on a webpage, use the tag. The tag allows you to add image source, alt, width, height, etc. The src is to add the image URL. The alt is the alternate text attribute, which is text that is visible when the image fails to load.With HTML, add the image source as the path of your system drive. For that, add the src attribute as a link to the path of system drive where the image is stored. For example, file:/D:/images/logo.pngThe following are the attributes:Sr.No.Attribute & Description1AltThe alternate text for the image2HeightThe height of the image3IsmapThe ...
Read MoreHow to concatenate several strings in JavaScript?
To concatenate several string, use "Array.join()" method. Here, we will concat the following strings: John Amit Sachin Example You can try to run the following code to concat several strings var arr = ['Amit', 'John', 'Sachin']; document.write(arr.join(', '));
Read MoreHow to create a link to send email with a subject in HTML?
To create a link to send email, use tag, with href attribute. The mail to link is added inside the tag. To add a subject, you need to add ? and then include the subject. All this comes inside the tag. Just keep in mind to add the email address where you want to receive the email in the mail to link. Also, the spaces between words for the subject shouldn't be space, instead include %20. This is to ensure the browser displays the text properly. Example You can try to run the following code to ...
Read MoreHow to call a JavaScript Function from Chrome Console?
To call a JavaScript function from the console, run the following code:Example var display = { displayOne: function(){ return "displayTwo" ;} }; console.log(display.displayOne());
Read MoreHow to use typeof with arguments in JavaScript?
Arguments object is the arguments passed to a function. It is a variable accessible for all functions. Let's say two arguments are passed to a function, then you can access them like the following: arguments[0] arguments[1] In the same way, you can use a type of with arguments in JavaScript. Firstly, let's see how to work with the type of. The type of operator is a unary operator that is placed before its single operand, which can be of any type. Example The following code shows how to implement type of operator var a = 20; var b = "String"; var linebreak = "<br />"; result = (typeof b == "string" ? "B is String" : "B is Numeric"); ...
Read MoreWhat is arguments object in JavaScript?
Arguments object in JavaScript is an object, which represents the arguments to the function executing. Its syntax has two arguments: [function.]arguments[p] Example You can try to run the following code to learn what are arguments object in JavaScript function functionArgument(val1, val2, val3) { var res = ""; res += "Expected Arguments: " + functionArgument.length; res += "<br />"; res += "Current Arguments : " + arguments.length; res += "<br />"; res += "Each argument = " for (p = 0; p < arguments.length; p++) { res += "<br />"; res += functionArgument.arguments[p]; res += " "; } document.write(res); } functionArgument(20, 50, 80, "Demo Text!","Hello World", new Date())
Read MoreHow to edit a JavaScript alert box title?
It’s not possible to edit a JavaScript alert box title due to security issues. Still, to edit an alert box to work it all web browsers, use custom JavaScript Modal Dialogs or jQuery plugins.You can also use a custom alert box like Sweet Alert to get a custom alert box, with a title of your choice:
Read MoreWhat is super() function in JavaScript?
Use the super() function to call the constructor of the parent class and access functions on an object's parent class. Example You can try to run the following code to implement super() class Department { constructor() {} static msg() { return 'Hello'; } } class Employee extends Department { constructor() {} static displayMsg() { return super.msg() + ' World!'; } } document.write(Employee.displayMsg());
Read MoreHow to provide new line in JavaScript alert box?
To add a new line in JavaScript alert box, use the "": alert("Line One Line Two"); Example You can try to run the following code add a new line in an alert box in JavaScript: Click the following button to see the result:
Read More