Javascript Articles

Page 519 of 534

How to set src to the img tag in HTML from another domain?

Akshaya Akki
Akshaya Akki
Updated on 09-Jan-2020 3K+ Views

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 More

How to set src to the img tag in html from the system drive?

Manikanth Mani
Manikanth Mani
Updated on 09-Jan-2020 19K+ Views

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 More

How to concatenate several strings in JavaScript?

Ramu Prasad
Ramu Prasad
Updated on 09-Jan-2020 320 Views

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 More

How to create a link to send email with a subject in HTML?

Ayyan
Ayyan
Updated on 09-Jan-2020 21K+ Views

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 More

How to call a JavaScript Function from Chrome Console?

Sreemaha
Sreemaha
Updated on 09-Jan-2020 2K+ Views

To call a JavaScript function from the console, run the following code:Example                    var display = {             displayOne: function(){ return "displayTwo" ;}          };          console.log(display.displayOne());          

Read More

How to use typeof with arguments in JavaScript?

Sravani S
Sravani S
Updated on 09-Jan-2020 892 Views

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 More

What is arguments object in JavaScript?

Priya Pallavi
Priya Pallavi
Updated on 08-Jan-2020 277 Views

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 More

How to edit a JavaScript alert box title?

Vrundesha Joshi
Vrundesha Joshi
Updated on 08-Jan-2020 7K+ Views

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 More

What is super() function in JavaScript?

radhakrishna
radhakrishna
Updated on 08-Jan-2020 320 Views

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 More

How to provide new line in JavaScript alert box?

Rishi Rathor
Rishi Rathor
Updated on 08-Jan-2020 796 Views

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
Showing 5181–5190 of 5,339 articles
« Prev 1 517 518 519 520 521 534 Next »
Advertisements