aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes upgrading to html 5:  javascript inline  (not internal, but inline, e.g. inside onclick) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "upgrading to html 5:  javascript inline  (not internal, but inline, e.g. inside onclick)" Watch "upgrading to html 5:  javascript inline  (not internal, but inline, e.g. inside onclick)" New topic
Author

upgrading to html 5: javascript inline (not internal, but inline, e.g. inside onclick)

Jesus Angeles
Ranch Hand

Joined: Feb 26, 2005
Posts: 2057
Hi,

I understand that, for external, and internal, we remove some attributes like those that specify javascript, like below:


How about for inline javascript?

Do we need to remove those "javascript:" prefixes?

-------------
Example:



-------------
Example:



-------------

Are there any rule on this? Should we remove the "javascript:" on all of them? Or just leave them alone there?
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61628
    
  67

For the href the "javascript:" prefix is a pseudo-protocol to distinguish it from other protocols such as http:. On attributes such as onclick, its useless and shouldn't be specified.

Of course, if you're using Unobtrusive JavaScript, you aren't mixing script in with the structure and don't use attributes such as onclick at all.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 10263
    
168

Bear Bibeault wrote:
Of course, if you're using Unobtrusive JavaScript, you aren't mixing script in with the structure and don't use attributes such as onclick at all.


That's new to me and just did a quick search on it and it does make sense. Learnt something new

[My Blog] [JavaRanch Journal]
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61628
    
  67

In the same way that CSS removes style form the structure, Unobtrusive JavaScript removes behavior from the structure. This makes for good Separation of Concerns between style, behavior and structure.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: upgrading to html 5: javascript inline (not internal, but inline, e.g. inside onclick)