Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

In the following code:

<a onclick="javascript:alert()">

how do you name the javascript: part? Protocol, pseudo-protocol, scheme, label, prefix?

I am only trying to figure out a common name for it, not technically correct term based on what it actually is at the end. So when I say for example "javascript protocol" most people would be able understand what I mean. (I need to use this in a documentation)

share|improve this question

1 Answer 1

< a onclick="javascript:alert()">

I don't believe using javascript: in anything other than the href attribute is even valid (though it appears browsers will still execute it - I believe this is because technically javascript: in this context is a label, are you planning to goto javascript;?).

Also, it's considered very bad form to use inline event handlers like that. And if I'm not mistaken it's even been deprecated by W3C.

But, fwiw, when javascript: is used in an href it is called a "pseudo-protocol identifier".

share|improve this answer
    
You could use it to break an outer loop. But even that purpose is essentially forgotten. –  Reid Mar 25 '11 at 22:41
1  
@Reid: and completely irrelevant (for use) in an inline event handler. –  qes Mar 26 '11 at 0:24

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.