Programming Scripts Articles

Page 19 of 33

With JavaScript Regular Expression find a non-whitespace character.\\n\\n

Daniol Thomas
Daniol Thomas
Updated on 23-Jun-2020 497 Views

To find a non-whitespace character, use the following −\SExampleYou can try to run the following code to find non-whitespace character −        JavaScript Regular Expression                        var myStr = "100% Responsive!";          var reg = /\S/g;          var match = myStr.match(reg);                    document.write(match);          

Read More

For Hosts Locale how to convert a string to lowercase letters in JavaScript?

Lakshmi Srinivas
Lakshmi Srinivas
Updated on 23-Jun-2020 189 Views

To convert a string to lowercase letters in JavaScript, use the toLocaleLowerCase() method. Example You can try to run the following code to learn how to work with toLocaleLowerCase() method in JavaScript −                     var a = "WELCOME!";          document.write(a.toLocaleLowerCase());           

Read More

With JavaScript RegExp search a carriage return character.

Ayyan
Ayyan
Updated on 23-Jun-2020 735 Views

To find carriage return character with JavaScript Regular Expression, use the following −\rExampleYou can try to run the following code to find a carriage return character. It returns the position where the carriage return (\r) character is found −           JavaScript Regular Expression                        var myStr = "100% \r Responsive!";          var reg = /\r/;          var match = myStr.search(reg);                    document.write(match);          

Read More

What is the usage of in operator in JavaScript?

Arushi
Arushi
Updated on 23-Jun-2020 182 Views

The operator is used in JavaScript to check whether a property is in an object or not. Example You can try to run the following code to learn how to use in operator in JavaScript –             var emp = {name:"Amit", subject:"Java"};      document.write("name" in emp);      document.write("");      document.write("subject" in emp);      document.write("");      document.write("MAX_VALUE" in Number);      document.write("");      document.write("MIN" in Number);       

Read More

With JavaScript RegExp find a character except newline?

Anvi Jain
Anvi Jain
Updated on 23-Jun-2020 281 Views

To find a character except for a newline, use the Metacharacter. (period). You can try to run the following code to find a character −Example           JavaScript Regular Expression                        var myStr = "We provide websites! We provide content!";          var reg = /p.o/g;          var match = myStr.match(reg);                    document.write(match);          

Read More

With JavaScript DOM delete rows in a table?

Sharon Christine
Sharon Christine
Updated on 23-Jun-2020 6K+ Views

To delete rows in a table in JavaScript, use the DOM deleteRow() method. Example You can try to run the following code to learn how to delete rows in a table. The code deletes rows one at a time −           function captionFunc(x) {      document.getElementById(x).createCaption().innerHTML = "Demo Caption";    }                           One       Two                   Three       Four                   Five       Six                                         

Read More

How to create a table caption with JavaScript DOM?

Jai Janardhan
Jai Janardhan
Updated on 23-Jun-2020 650 Views

To create a table caption, use the DOM createCaption() method. Example You can try to run the following code to learn how to create table caption −             function captionFunc(x) {        document.getElementById(x).createCaption().innerHTML = "Demo Caption";      }                            One        Two                    Three        Four                    Five        Six                           

Read More

How to perform Multiline matching with JavaScript RegExp?

Moumita
Moumita
Updated on 23-Jun-2020 683 Views

To perform multiline matching, use the M modifier available in JavaScript Regular Expression.ExampleYou can try to run the following code to perform multiline matching −           JavaScript Regular Expression                        var myStr = "Welcoming!";          var reg = /^ing/m;          var match = myStr.match(reg);                    document.write(match);          

Read More

Which is the JavaScript RegExp to find any alternative text?

Nikitha N
Nikitha N
Updated on 23-Jun-2020 265 Views

To match any of the specified alternatives, follow the below-given pattern −(foo|bar|baz)ExampleYou can try to run the following code to find any alternative text −           JavaScript Regular Expression                        var myStr = "one,one,one, two, three, four, four";          var reg = /(one|two|three)/g;          var match = myStr.match(reg);          document.write(match);          

Read More

How can I write a script to use either W3C DOM or IE 4 DOM depending on their availability?

Abhinanda Shri
Abhinanda Shri
Updated on 23-Jun-2020 167 Views

If you want to write a script with the flexibility to use either W3C DOM or IE 4 DOM depending on their availability, then you can use a capability-testing approach that first checks for the existence of a method or property to determine whether the browser has the capability you desire.The following is the code snippet showing the same −if (document.getElementById) {    // If the W3C method exists, use it } else if (document.all) {    // If the all[] array exists, use it } else {    // Otherwise use the legacy DOM }

Read More
Showing 181–190 of 328 articles
« Prev 1 17 18 19 20 21 33 Next »
Advertisements