Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Java > Java and JDK > Pro JSP
|
Pro JSP Advanced JSP coding questions. Beginning questions will be redirected to the Beginning JSP forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Pro JSP section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 31st, 2007, 10:27 AM
Registered User
 
Join Date: Jul 2007
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Works in IE but not in FF

I have the following function that works fine in IE but it gives and error in FF. What can I do to make this work in both browsers?.

The error that FF gives is the following:
 
Quote:
quote:event is not defined
Quote:

mtdChecaTecla()pestanas.js (line 28)
onkeydown(keydown charCode=0, keyCode=97)peemgral01.jsp (line 1)
[Break on this error] if ( event.altKey && event.keyCode != 18 ) {
AND HERE IS THE CODE
Code:
var mbFrameEncontrado = false;
var lObjFramePestanas = new Object();
var lObjFormPestanas  = new Object();

function mtdChecaTecla()    {

    if (  event.altKey  &&  event.keyCode != 18 )    {

        var lObjFrames = top.frames;
        var lbOprimioAtl = event.altKey;
        var liAsciiTecla = event.keyCode;

        mtdBuscaFrame( lObjFrames );

        if ( mbFrameEncontrado )    {

            lObjFramePestanas.mtdChecaTecla( lbOprimioAtl, liAsciiTecla )

            mbFrameEncontrado = false;
        }

    }
}
 
Old September 12th, 2007, 11:20 PM
Friend of Wrox
 
Join Date: Mar 2007
Posts: 373
Thanks: 0
Thanked 1 Time in 1 Post
Default

"event" object will not be availble directly in javascript when you use FF it works only with IE, you've to pass it as argument to the java script method while calling it. Try like as follows
function mtdChecaTecla(event) {
...
}
and in the html/jsp try like
<input type="text" onkeyup="mtdChecaTecla(event);" />

Hope that solves it.

- Rakesh





Similar Threads
Thread Thread Starter Forum Replies Last Post
Javascript works in IE7 not in FF 2 swifty_programmer Javascript 2 August 31st, 2007 02:07 AM
odd FF error, IE does nothing when run. JustABob Javascript 4 November 29th, 2005 01:50 PM
fade in not working in FF but does in IE crmpicco Javascript How-To 1 November 8th, 2005 12:49 PM
Window status works in FF, but not IE...why? msprothero Javascript 2 March 22nd, 2005 10:10 AM
Cross-frame scripting, works in FF but not IE Snib Javascript 4 October 25th, 2004 08:54 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.