Error in javascript for 1.7 and 1.8 mozilla versions.

RESOLVED DUPLICATE of bug 246385

Status

()

Core
DOM: Core & HTML
RESOLVED DUPLICATE of bug 246385
13 years ago
10 months ago

People

(Reporter: Juarez Josende do Canto, Unassigned)

Tracking

({qawanted, regression})

Trunk
qawanted, regression
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

(Reporter)

Description

13 years ago
User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7) Gecko/20040616
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7) Gecko/20040616

In the code in "Additional Information" if You click in the <TD> that simulates
a button, the javascript code is not executed.
It works for Mozilla 1.0 to 1.6, IE and Opera.


Reproducible: Always
Steps to Reproduce:
1.
2.
3.




<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 TRANSITIONAL//EN">
<HTML>
	<HEAD>
		<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
		<META HTTP-EQUIV="Expires" CONTENT="0">
		<STYLE TYPE="text/css">
			td.botao{cursor:pointer;cursor:hand;padding:2px
7px;border-color:#c1dff9;border-width:2px;border-style:outset;background-color:#204070;font-size:12px;font-weight:bold;font-family:verdana,sans-serif;color:#80A0C0;filter:progid:DXImageTransform.Microsoft.Gradient(startColorstr="#4080B0",endColorstr="#204070");}
		</STYLE>
	</HEAD>
	<BODY>
		<TABLE>
			<TR>
				<TD>
					<FORM NAME="formDados" METHOD="post" ACTION="Brbw4Dhw_Login_Operador.aspx">
						<TABLE>
							<TR>
								<TD ALIGN="right">
									Senha:
								</td>
								<TD ALIGN='left'>
									<INPUT TYPE="text" NAME="Asteriscos" SIZE="10" DISABLED VALUE="">
									<INPUT TYPE="hidden" NAME="Senha" SIZE='10'>
								</td>
								<TD UNSELECTABLE="on" ALIGN="center" CLASS="botao"
ONCLICK='Tecla("1",Asteriscos, Senha);'>
									OK
								</TD>
								<TD ALIGN="center">
									<INPUT TYPE="button" VALUE="OK" ONCLICK="Tecla('1',Asteriscos, Senha);">
								</TD>
							</tr>
						</TABLE>
					</FORM>
				</TD>
			</TR>
		</TABLE>
		<SCRIPT>
		function Tecla(Caracter, Asteriscos, Senha)
		{
			if(Senha.value.length == Senha.size) return;

			Asteriscos.value += "*";
			Senha.value += Caracter;
		}
		</SCRIPT>		
	</BODY>
</HTML>
Created attachment 154356 [details]
reporter's testcase
since the <td> is no form element, name lookup does not search in the form. use
document.forms[0].Asteriscos and document.forms[0].Senha in the Tecla call in
the <td>.

note that the javascript _is_ executed, but throws an exception, check tools|web
development|javascript console.

however... bz, why did this work previously?
It worked because of this scope chain lookup mess (which we eliminated for
compat with IE?  Then why's it working in IE?)
Assignee: general → general
Component: Browser-General → DOM: Level 0
Keywords: regression
OS: Windows 2000 → All
QA Contact: general → ian
Hardware: PC → All
Summary: Error in javascrip for 1.7 and 1.8 mozilla versions. → Error in javascript for 1.7 and 1.8 mozilla versions.
Depends on: 242557
Maybe IE does the weird-ass form-lookup thing that we do for form controls, for 
everything? That would explain it... Someone should test this...
This "someone" needs to be someone with access to IE....

Comment 6

13 years ago
Yes,
Asteriscos.value += "*";
and
Senha.value += Caracter;
in the code of the provided testcase will be executed without javascript error
reported in MSIE 6 (I checked with Microsoft Javascript Debugger as well with a
step by step debugging). There is no need to prefix form input control with
document.forms["FormName"] or document.FormName in MSIE 6. Even for submit controls.
Keywords: qawanted

Comment 7

13 years ago
(In reply to comment #4 and comment #5)

Reference worth mentioning:
Referencing Forms and Form Controls
http://www.jibbering.com/faq/faq_notes/form_access.html

So far, I have tested 8 cases related to MSIE 6 specific chain scope lookup,
trying to identify differences with Mozilla:

http://www10.brinkster.com/doctorunclear/Bugzilla/Bug253091.html

Comment 8

12 years ago
This page
http://www.gtalbot.org/BugzillaSection/Bug253091.html
can be improved but it will do for now.

Comment 9

10 years ago
The standard version of Sun Java when installed through the automatic set-up in Internet explorer normally will pick up that Firefox has been installed and install the relevant adapter and it should help update to the latest version which I think is something like 5.0 but it can be worth-while removing sun Java and see whether the Microsoft Virtual machine works without the problem, as sometimes if one version of the Java system works and the other does not, then it can show that you may be better off using the Microsoft Virtual machine which I believe has to be downloaded and installed manually through microsft.com 

Comment 10

9 years ago
In Internet Explorer, named form controls are visible in the global scope. This
is wrong. 

If someone visits this bug, then (s)he can fix this problem by following
timeless' recommendation in bug 246197 comment #1.

More info available on how to do this at:

Accessing Elements with the W3C DOM 
http://developer.mozilla.org/en/Using_Web_Standards_in_your_Web_Pages/Using_the_W3C_DOM#Accessing_Elements_with_the_W3C_DOM

Resolving as a DUPLICATE of bug 246385
Status: UNCONFIRMED → RESOLVED
Last Resolved: 9 years ago
Resolution: --- → DUPLICATE
Duplicate of bug: 246385
You need to log in before you can comment on or make changes to this bug.