Does inline Javascript code like this below:
<div onclick='javascript:some_function();'></div>
grow up web page’s loading time in any way?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Yes, it does.
The browser must fire up a separate Javascript parser for each attribute.
It is more efficient to bind the events to functions using
attachEvent/addEventHandler, or, more easily, jQuery.On an unrelated note, you shouldn’t use
javascript:in an event attribute (aside from the fact that you shouldn’t use event attributes at all). It’s just an unused label.In
hrefattributes, thejavascript:protocol allows you to create a URI that executes Javascript. However, event attributes take a string of Javascript code, not a URI.