Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Invoking functions in Javascript

 
Ranch Hand
Posts: 81
IntelliJ IDE Oracle C++
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 81
IntelliJ IDE Oracle C++
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 81
IntelliJ IDE Oracle C++
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator

should be


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

Eric
 
Sen George
Ranch Hand
Posts: 81
IntelliJ IDE Oracle C++
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
Let us ignore this post. I am going to submit a different post with another piece of code.
 
Consider Paul's rocket mass heater.
    Bookmark Topic Watch Topic
  • New Topic