472,789 Members | 1,050 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,789 software developers and data experts.

Javascript firefox problem

Hi,
I have a problem with our intranet, we are planning to install Firefox
instead of Internet Explorer onto some new PCs.

However, we can't get the following JavaScript to work in Firefox and
similar code is used in lots of the intranet stuff.
The code should bring up a message box with a warning and not allow
the user to continue unless they have filled in the entry in an html
form (the form is called 'myauthor').
if (checkempty(Document.myauthor.Candidate.Value,"You have left the
Candidate field empty."))= false then validation=false
If validation= True then
myauthor_OnSubmit = True
else
myauthor_OnSubmit = False
End if
End function
Function checkempty(ByVal FieldValue, ByVal message)
If FieldValue = "" then
MsgBox message, 8, Header
checkempty = False
else
checkempty = true
End if
end function

No errors or warnings appear in the firefox JavaScript console. The
page just accepts the form and continues as if the checking code
weren't there at all.

Thanks for any help,
Dave

Jul 23 '05 #1
4 3638


Dave Blair wrote:

However, we can't get the following JavaScript to work in Firefox and
similar code is used in lots of the intranet stuff.
The code should bring up a message box with a warning and not allow
if (checkempty(Document.myauthor.Candidate.Value,"You have left the
Candidate field empty."))= false then validation=false
If validation= True then
myauthor_OnSubmit = True
else
myauthor_OnSubmit = False
End if
End function
Function checkempty(ByVal FieldValue, ByVal message)
If FieldValue = "" then
MsgBox message, 8, Header
checkempty = False
else
checkempty = true
End if
end function

No errors or warnings appear in the firefox JavaScript console. The
page just accepts the form and continues as if the checking code
weren't there at all.


That is not JavaScript but VBScript so there is no way FireFox or any
other browser besides IE/Win is going to run that code.

--

Martin Honnen
http://JavaScript.FAQTs.com/

Jul 23 '05 #2
Dave Blair wrote:
Hi,
I have a problem with our intranet, we are planning to install Firefox
instead of Internet Explorer onto some new PCs.

However, we can't get the following JavaScript to work in Firefox and
similar code is used in lots of the intranet stuff.
The code should bring up a message box with a warning and not allow
the user to continue unless they have filled in the entry in an html
form (the form is called 'myauthor').
if (checkempty(Document.myauthor.Candidate.Value,"You have left the
Candidate field empty."))= false then validation=false
If validation= True then
myauthor_OnSubmit = True
else
myauthor_OnSubmit = False
End if
End function
Function checkempty(ByVal FieldValue, ByVal message)
If FieldValue = "" then
MsgBox message, 8, Header
checkempty = False
else
checkempty = true
End if
end function

No errors or warnings appear in the firefox JavaScript console. The
page just accepts the form and continues as if the checking code
weren't there at all.

Thanks for any help,
Dave


Hmm ... perhaps it's because most of the code, you've written isn't
Javascript - but rather VBScript which is also supported in IE

i've taken the liberty to rewrite it (sort of) in javascript...

function checkEmpty( value, errMessage ) {
if(value=="") {
Alert( errMessage );
return false;
} else {
return true;
}
}
if( checkEmpty( document.forms['myauthor'].candidate.value, "You have
left the Candidate field empty..." ) ) {
/* validation ok - submit the form */
document.forms['myauthor'].submit();
} else {
/* don't do anything - vaidation failed */
return false;
}

/Søren Munk Skrøder
Odense, Denmark
soeren at skroeder dot dk
Jul 23 '05 #3
I'm an idiot!!

I knew it was VBscript, but had just finished with another problem
that was Javascript (a menu, which is now working). And somehow my
brain hadn't woken up and...........monday morning.....and......

Anyway, thanks for the replies and the re-write!

On Mon, 28 Jun 2004 14:45:06 +0200,
=?ISO-8859-1?Q?S=F8ren_Munk_Skr=F8der?= <a@b.com> wrote:
Dave Blair wrote:
Hi,
I have a problem with our intranet, we are planning to install Firefox
instead of Internet Explorer onto some new PCs.

However, we can't get the following JavaScript to work in Firefox and
similar code is used in lots of the intranet stuff.
The code should bring up a message box with a warning and not allow
the user to continue unless they have filled in the entry in an html
form (the form is called 'myauthor').
if (checkempty(Document.myauthor.Candidate.Value,"You have left the
Candidate field empty."))= false then validation=false
If validation= True then
myauthor_OnSubmit = True
else
myauthor_OnSubmit = False
End if
End function
Function checkempty(ByVal FieldValue, ByVal message)
If FieldValue = "" then
MsgBox message, 8, Header
checkempty = False
else
checkempty = true
End if
end function

No errors or warnings appear in the firefox JavaScript console. The
page just accepts the form and continues as if the checking code
weren't there at all.

Thanks for any help,
Dave


Hmm ... perhaps it's because most of the code, you've written isn't
Javascript - but rather VBScript which is also supported in IE

i've taken the liberty to rewrite it (sort of) in javascript...

function checkEmpty( value, errMessage ) {
if(value=="") {
Alert( errMessage );
return false;
} else {
return true;
}
}
if( checkEmpty( document.forms['myauthor'].candidate.value, "You have
left the Candidate field empty..." ) ) {
/* validation ok - submit the form */
document.forms['myauthor'].submit();
} else {
/* don't do anything - vaidation failed */
return false;
}

/Søren Munk Skrøder
Odense, Denmark
soeren at skroeder dot dk


Jul 23 '05 #4
Dave Blair wrote:
Hi,
I have a problem with our intranet, we are planning to install Firefox
instead of Internet Explorer onto some new PCs.

However, we can't get the following JavaScript to work in Firefox and
similar code is used in lots of the intranet stuff. [snip]
Function checkempty(ByVal FieldValue, ByVal message)
If FieldValue = "" then
MsgBox message, 8, Header
checkempty = False
else
checkempty = true
End if
end function

That code (above) is VBScript, not JavaScript or ECMAScript, so it has
no chance on anything except Microsoft-only browsers written to work
with Micrososft-only code. In other words - it will never run on Firefox
OR on any non-Wondows system.
Jul 23 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
by: Howard Kaikow | last post by:
Yesterday, I decided to try Firefox. I've encountered a behavior that is either a bug in Firefox or a bug in my Javascript code. I'll try to explain the problem, hoping that this newsgroup can...
5
by: LRW | last post by:
(Sorry if this is a repost...my newsreader keeps crashing on the posting--I don't know if the message going out or not) For some reason this javascript just won't work in Firefox. It works fine...
14
by: tshad | last post by:
I posted this on the asp.net group, also. I wasn't sure whether this was an asp.net problem or a javascript problem. I have a page that was originally created from a program I found on the net...
2
by: John | last post by:
I've been working on making my ASP.NET web apps compatible with Firefox (the uplevel configs for web.config are a real help). However, one really weird thing is a GotoAnchor() function I have...
8
by: chrisdude911 | last post by:
how do i add video into a javascript web page with my own custom buttons?
11
by: minnesotti | last post by:
Hi there, I subscribed to a photographic pictures-hosting website which is heavy on JavaScript. My preferred latest browser Mozilla Firefox does not work with it -- no pictures are displayed and...
7
by: Adam | last post by:
Hello All, I have run into a JS / CSS layout issue in IE, and I can't for the life of me figure out what's going on. Basically, I have one DIV that is expanding beyond the bounds of the...
16
by: Eric | last post by:
I have a user of a web application written in Java/JSP that is unable to login to the site simply because certain links on the page do not run when they are clicked. Other popups using Javascript...
6
by: scotty | last post by:
I have a script that loops through an existing table list and prepares each href element node to trigger a function when an image is clicked. The function that will be run passes a property value...
3
by: willyWEB66 | last post by:
Hi everyone, I'm having problem with the sequence of execution for xml.onload. It works fine if your not passing parameters to onload event but my code needs to pass parameter to its function. I'm...
0
by: erikbower65 | last post by:
Using CodiumAI's pr-agent is simple and powerful. Follow these steps: 1. Install CodiumAI CLI: Ensure Node.js is installed, then run 'npm install -g codiumai' in the terminal. 2. Connect to...
0
linyimin
by: linyimin | last post by:
Spring Startup Analyzer generates an interactive Spring application startup report that lets you understand what contributes to the application startup time and helps to optimize it. Support for...
0
by: kcodez | last post by:
As a H5 game development enthusiast, I recently wrote a very interesting little game - Toy Claw ((http://claw.kjeek.com/))。Here I will summarize and share the development experience here, and hope it...
0
by: Taofi | last post by:
I try to insert a new record but the error message says the number of query names and destination fields are not the same This are my field names ID, Budgeted, Actual, Status and Differences ...
0
by: Rina0 | last post by:
I am looking for a Python code to find the longest common subsequence of two strings. I found this blog post that describes the length of longest common subsequence problem and provides a solution in...
5
by: DJRhino | last post by:
Private Sub CboDrawingID_BeforeUpdate(Cancel As Integer) If = 310029923 Or 310030138 Or 310030152 Or 310030346 Or 310030348 Or _ 310030356 Or 310030359 Or 310030362 Or...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
0
by: lllomh | last post by:
How does React native implement an English player?
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.