![Trending Articles on Technical and Non Technical topics](/images/trending_categories.jpeg)
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 9326 Articles for Object Oriented Programming
![Chandu yadav](https://www.tutorialspoint.com/assets/profiles/22330/profile/60_142811-1519038104.jpg)
125 Views
Store it like the following −var players = { 600 : 'Sachin', 300 : 'Brad', };For key/ value pairs, we have used the above solution, since we wanted a one-to-one. We did this to use the key as a lookup key. You can also add more values like this −var players = { 900 : 'Sachin', 300 : 'Brad', 700 : 'Steve', 200 : 'Rahul', 600 : 'Kevin', 500 : 'David', }
![George John](https://www.tutorialspoint.com/assets/profiles/13511/profile/60_58410-1512537824.png)
1K+ Views
To deal with “Object doesn’t support this property or method” issue in JavaScript, while using events and Internet Explorer, update your code with this −Example ... You can also use attachEvent in IE to solve this issue like this −if (ev.addEventListener) { ev.addEventListener('click', myText, false); } else if (ev.attachEvent) { ev.attachEvent('onclick', myText); }
![Chandu yadav](https://www.tutorialspoint.com/assets/profiles/22330/profile/60_142811-1519038104.jpg)
500 Views
The best way to detect a ‘touch screen’ device, is to work around to see whether the touch methods are present within the document model or not.function checkTouchDevice() { return 'ontouchstart' in document.documentElement; }Here, you can also use it to detect mobile or desktop, like the following −if (checkTouchDevice()) { // Mobile device } else { // Desktop }
![Rishi Rathor](https://www.tutorialspoint.com/assets/profiles/13563/profile/60_89283-1512714754.jpg)
555 Views
To set height equal to the dynamic width in JavaScript, you can try to run the following code −Example .wrap { width:400px; height:300px; border:2px solid yellow; } .myChild{ width: 80%; border:1px solid red; } var res = $('.myChild').width(); $('.myChild').css({ 'height': res + 'px' });
![George John](https://www.tutorialspoint.com/assets/profiles/13511/profile/60_58410-1512537824.png)
123 Views
The setInterval() method is used evaluate an expression at specified intervals. This function calls function after every duration milliseconds. This goes for unlimited times. Let’s see an example −It triggers alert(‘Hello’) after every 2000 milliseconds, not only once.setInterval(function() { alert('Hello');}, 2000);To clear the usage of setInterval(), use the window.clearInterval() and set the parameter as the ID, likewindow.setInterval();
![Daniol Thomas](https://www.tutorialspoint.com/assets/profiles/13551/profile/60_130035-1512726078.jpg)
231 Views
The usage of anonymous functions affect performance is the sense, you need to create a new function object at each iteration. Anonymous functions are always loaded using a variable name. Anonymous, as the name suggests, allows creating a function without any names identifier. It can be used as an argument to other functions. Call them using a variable name −ExampleThis is how JavaScript anonymous functions can be used −var func = function() { alert(‘This is anonymous'); } func();Here’s an example −//anonymous function var a = function() { return 5; }
![Abhinanda Shri](https://www.tutorialspoint.com/assets/profiles/13552/profile/60_73264-1512711555.jpg)
212 Views
Yes, iOS capture onscroll events for a scroll. This is called one-finger events. What the user is tapping or touching decides whether an event is generated or not.Here is panning gesture,Image credit − AppleIt can also be touch and hold gesture,Image credit − Apple
![Ankitha Reddy](https://www.tutorialspoint.com/assets/profiles/13550/profile/60_73963-1512711511.jpg)
68 Views
To set the order of the flexible item, relative to the rest of JavaScript, use the order property. You can try to run the following code to implement order property − Example Live Demo #box { border: 1px solid #000000; width: 420px; height: 150px; display: flex; } #box div { height: 80px; width: 80px; } DIV1 DIV2 DIV3 Set function display() { document.getElementById("myID1").style.order = "3"; document.getElementById("myID2").style.order = "1"; document.getElementById("myID3").style.order = "2"; }
![Arjun Thakur](https://www.tutorialspoint.com/assets/profiles/13574/profile/60_74441-1560315595.jpg)
1K+ Views
To inject JavaScript in WebBrowser control, use the following steps − Firstly, create a Windows Forms application in Visual Studio. Now, drag a WebBrowser control to the form Set the Url property. Right-click the project, choose to Add reference... → COM → Type Libraries Select "Microsoft HTML Object Library" Add the following code to inject JavaScript.private void myWebBrowser(object sender, WebBrowserDocumentCompletedEventArgs e){ // head element HtmlElement hElement = weBrowser.Document.GetElementsByTagName("head")[0]; // script element HtmlElement sElement = weBrowser.Document.CreateElement("script"); IHTMLScriptElement val = (IHTMLScriptElement)sElement.DomElement; element.text = "function sayHello() { alert('Weclome') }"; hElement.AppendChild(sElement); weBrowser.Document.InvokeScript("How you doing?"); }