aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes Invoking functions in Javascript Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Reply locked New topic
Author

Invoking functions in Javascript

Sen George
Ranch Hand

Joined: Sep 21, 2005
Posts: 76
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

Joined: Jan 10, 2002
Posts: 61232
    
  66

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?


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61232
    
  66

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

Joined: Nov 08, 2001
Posts: 15376
    
    6
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

Joined: Sep 21, 2005
Posts: 76
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

Joined: Jan 10, 2002
Posts: 61232
    
  66

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

Joined: Sep 21, 2005
Posts: 76
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

Joined: Jan 10, 2002
Posts: 61232
    
  66

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

Joined: Nov 08, 2001
Posts: 15376
    
    6

should be


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

Eric
Sen George
Ranch Hand

Joined: Sep 21, 2005
Posts: 76
Let us ignore this post. I am going to submit a different post with another piece of code.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Invoking functions in Javascript