473,320 Members | 1,699 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

Why error in IE not Firefox?

Tell I'm stupid if you will.... the following works on Firefox but not
in IE (6) - gives an error

Line 16 Char 3
Illegal Assignment

<html>
<body>
<form name=f>
<input type=text name=inp>
&nbsp;
<input type=button value=convert onclick="conv();">
&nbsp;
<input type=text name=out>
</form>
<script type="text/javascript">
function conv()
{
f=document.forms[0].inp;
alert ("input"+ f.value);
}
</script>
</body>
</html>

Also, any good javascript debuggers available free of charge?
--

jeremy

Oct 26 '05 #1
2 1458
Jeremy wrote:
Tell I'm stupid if you will.... the following works on Firefox but not
in IE (6) - gives an error

Line 16 Char 3
Illegal Assignment

<html>
<body>
<form name=f>
IE makes the name of the form as a global variable, Firefox doesn't.
<input type=text name=inp>
&nbsp;
<input type=button value=convert onclick="conv();">
&nbsp;
<input type=text name=out>
</form>
<script type="text/javascript">
function conv()
{
f=document.forms[0].inp;
Here you create another global variable called 'f' that in IE conflicts
with the already declared f. It seems the form wins and the assignment
of the input reference is not achieved.

The simple solution is to include the keyword 'var' to make f a local
variable:

var f = document.forms[0].inp;

alert ("input"+ f.value);
}
</script>
</body>
</html>

Also, any good javascript debuggers available free of charge?

Use the javascript console in the Geko-based browsers (Firefox, Mozilla,
Netscape, et al).
--
Rob
Oct 26 '05 #2
In article <435f57e4$0$8658$5a62ac22@per-qv1-newsreader-
01.iinet.net.au>, RobG says...
Jeremy wrote:
Tell I'm stupid if you will.... the following works on Firefox but not
in IE (6) - gives an error

Line 16 Char 3
Illegal Assignment

<html>
<body>
<form name=f>


IE makes the name of the form as a global variable, Firefox doesn't.
<input type=text name=inp>
&nbsp;
<input type=button value=convert onclick="conv();">
&nbsp;
<input type=text name=out>
</form>
<script type="text/javascript">
function conv()
{
f=document.forms[0].inp;


Here you create another global variable called 'f' that in IE conflicts
with the already declared f. It seems the form wins and the assignment
of the input reference is not achieved.

Oh thanks very much for that.
<snip>
Also, any good javascript debuggers available free of charge?

Use the javascript console in the Geko-based browsers (Firefox, Mozilla,
Netscape, et al).


OK thanks I have played with these already - unfortunately when the
error only shows in IE.... :(
--

jeremy
Oct 26 '05 #3

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

Similar topics

2
by: Chuck Martin | last post by:
I am having a most frustrating problem that references, web searches, and other resources are no help so far in solving. Basically, I'm trying to design a pop-up window to be called with a funciton...
7
by: debugger | last post by:
hello, Question, on page load, I populate an existing drop down with createElement and appendChild. It works fine so far. BUT I want to automatically select some option from this populated drop...
4
by: gattaca8 | last post by:
The following script works fine in IE...but gives me a "sBox has no properties" error in Firefox. sBox is only used in the below method. function addTop (sectId) { sBox =...
3
by: Brian A | last post by:
I have written some Javascript that works perfectly in Firefox - no errors reported. The dreaded MSIE 6 produces nothing but a long line of 'undefinedundefinedundefinedundefinedundefined ....'...
0
by: Wayne Deleersnyder | last post by:
Hi All, I'm hoping to try to solve this error. I'm currently putting together a little web app, but I need it to work under both IE6, IE7, Mozilla, etc... Although the formatting is off for...
5
by: Geoff Cox | last post by:
hello, I am writing Javascript using Homesite but if I try to use Firefox v2 as the browser I get the error message "Firefox doesn't know how to open the address, because the protocol (c)...
1
by: nancyisbell | last post by:
I used the following test01.xml file below to exercise the cnlUnit01.xslt. <?xml version="1.0"?> <?xml-stylesheet type="text/xsl" href="cnlUnit01.xslt"?> <cnlUnitXsl unitDataFile="111111"/> ...
1
by: Joey | last post by:
asp.net 2/C#/VS2005 I have a webform that contains gridview that is databound to a dataset maintained in session state. Users can enter values into textboxes and add to the grid. For each row in...
2
by: germ | last post by:
doing a simple page webmethod call an a page via PageMethods works fine in ie7 & opera9 the same call on firefox ( and I assume netscape ) generates the following error : Error: " nsresult:...
1
by: jarret | last post by:
Hello all. First off, I am not a programmer so this question is not related to a problem that I created myself. I am not quite sure what is going on, but I do know that C++ is screwing up. Now I...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.