wood burning stoves 2.0*
The moose likes HTML, CSS and JavaScript and the fly likes javascript pseudo-protocol attribute value Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "javascript pseudo-protocol attribute value" Watch "javascript pseudo-protocol attribute value" New topic
Author

javascript pseudo-protocol attribute value

Michael Petrovich
Greenhorn

Joined: Sep 06, 2011
Posts: 16

I'm not so strong in JavaScript. Google doesn't understands semicolons.
Tell me please what this attribute value mean:
"javascript:;" ?
Like here:
<a href="javascript:;" class="buttonRed1 triggerModal" name="manageModal"><span>MANAGE SOME</span>

So what is "javascript:;" here? (Note: semicolon is here)
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61103
    
  66

The "javascript:" prefix is a pseudo-protocol that tell the browser to execute the supplied javascript when the link is clicked. In this example, that script is simply and empty statement followed by its terminating semi-colon.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Michael Petrovich
Greenhorn

Joined: Sep 06, 2011
Posts: 16

Sorry but I think that is not real.
I've seen html page with such code. And by clicking in corresponding reference some action is occurred.
Sorry but I can't post here all html page for security reasons.
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
Michael Petrovich wrote:Sorry but I think that is not real.


What do you mean by this. Bear's explaination is correct.

Michael Petrovich wrote:And by clicking in corresponding reference some action is occurred.


If some action occurred, there was probably an onclick event handler added to the element that fired some JavaScript code.

Eric
Michael Petrovich
Greenhorn

Joined: Sep 06, 2011
Posts: 16

Well the question is where is that handler, what this mechanism is for and how does it call?
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61103
    
  66

How can we possibly tell without seeing some code? If you can't show the real code, show us a CCSSE that demonstrates the issue.
Michael Petrovich
Greenhorn

Joined: Sep 06, 2011
Posts: 16

What is CCSSE?
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
Well the question is where is that handler


What does handler mean?


Eric

Michael Petrovich
Greenhorn

Joined: Sep 06, 2011
Posts: 16

I don't know what handler. That were your words:
Eric Pascarello wrote:
If some action occurred, there was probably an onclick event handler added to the element that fired some JavaScript code.
Eric
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
The onclick handler is added in the JavaScript code somewhere. Where and what it does is impossible for us to tell you since we do not have your source code.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61103
    
  66

Sorry, was a tad dyslexic, it should have been: SSCCE
 
 
subject: javascript pseudo-protocol attribute value