Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
    Bookmark Topic Watch Topic
  • New Topic

Invoking functions in Javascript

 
Sen George
Ranch Hand
Posts: 76
  • Mark post as helpful
  • send pies
  • Report post to moderator
Hi,

I am new to Javascript. I am just not able to get Javascript functions work in Firefox (ver 3.0.3).

Here is the sample code.



The image appears on the page. But upon 'right click', the context sensitive menu still appears.

Please advise.

Regards,
Sen
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64838
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Report post to moderator
Why would you want to block the context menu? All that will do is to tick off your visitors. Is that a requirement of your project?
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64838
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Report post to moderator
P.S. Please be sure to disable smilies when posting code.

And, is the following really how your code is?That's not even valid markup.
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Report post to moderator
Browsers disble the ability to disable the context menu, look at your settings and see if that is the case. [That also shows you why it is useless to disable the context menu]

Eric
 
Sen George
Ranch Hand
Posts: 76
  • Mark post as helpful
  • send pies
  • Report post to moderator
Thank you both for the responses. In fact, I was just trying an example from the book by Eric-JavaScript (Visual series).

The smiley usage was not intentional. Please advise if there is a way to suppress that even though some characters are part of the code itself.

The browser I am using is Firefox. I just checked the settings in the browser. The browser is enabled for Javascript. Also, in the advanced option for Javascript, the option 'Allow script to Disable or replace Context Menu' is checked. So I am a bit confused here.

My only intention is to make a function call in Javascript work. Please advise.

Sen
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64838
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Report post to moderator
Click the disable smilies checkbox to suppress smilies.

You also didn't address my other issue. The code you posted is invalid. Please clean it up and try again.
 
Sen George
Ranch Hand
Posts: 76
  • Mark post as helpful
  • send pies
  • Report post to moderator
The code example has been taken straight from the book. The image indeed appears on the browser page. All I am trying to do is make a function call work which doesn't happen in this case.

Would you like me to post another code sample in a new post?
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64838
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Report post to moderator
Until the markup is correct, you cannot count on any script behaving well. Are you sure that the markup in the book matches the invalid code that you have posted?
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Report post to moderator

should be


I have not checked to see if the book is missing.

Eric
 
Sen George
Ranch Hand
Posts: 76
  • Mark post as helpful
  • send pies
  • Report post to moderator
Let us ignore this post. I am going to submit a different post with another piece of code.
 
    Bookmark Topic Watch Topic
  • New Topic