
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How the Browser Identifies Inline JavaScripts
Let’s say the following line we have in our HTML −
<input type="Button" value="Result" onclick="alert(‘Hello World!’);"/>
Here the browser identifies inline JavaScript by detecting onclick, even when <script> tag wasn’t available.
The following are some of the suggestions for using inline JavaScripts −
- You should consider inline script elements such as <script>...</script>) if the script only to be used for a single page.
- Do not use event attributes such as onclick="...", and bind event handlers using JavaScript.
- Use external script elements such as <script src="..."></script>) for most scripts, especially if reused between pages.
Advertisements