Closed Bug 147218 Opened 23 years ago Closed 23 years ago

Javascript:show() isn't working

Categories

(Core :: DOM: Core & HTML, defect)

x86
Windows 98
defect
Not set
major

Tracking

()

RESOLVED INVALID

People

(Reporter: walter_ebeling, Assigned: jst)

References

()

Details

Attachments

(1 file)

From Bugzilla Helper:
User-Agent: Mozilla/5.0 (Windows; U; Win98; en-US; rv:1.0rc2) Gecko/20020510
BuildID:    2002052306

Moving the mouse above a hint in a web page isn't showing the hint. Works in
IE5.5 and NS4.77.

Reproducible: Always
Steps to Reproduce:
start test.html testcase

Actual Results:  JS Debugger is showing bugs

Expected Results:  Page should work as designed
Attachment #85107 - Attachment mime type: application/octet-stream → text/html
What's this attachment?
I tried to change it to text/html but it only displays as garbage.
The testcase is in a zip file. Mozilla is messing up the extension, see bug 
120327.... Rename it after downloading to zip, umpack the folder test and start 
test.html. 
Attachment #85107 - Attachment description: This i sa testcase, start test.html → This is a testcase, start test.html
Attachment #85107 - Attachment mime type: text/html → application/octet-stream
Attachment #85107 - Attachment description: This is a testcase, start test.html → Zip file containing testcase, start test.html
Reassigning to DOM Level 0 component; this is not a JS Engine issue -
Assignee: rogerl → jst
Component: JavaScript Engine → DOM Level 0
QA Contact: pschwartau → desale
Summary: Javascript:show isn't working → Javascript:show() isn't working
Here is the problem:

<div id="hint" style="position:  etc. etc."></div>

<a href="JavaScript:show(hint,hint1,400);"
   onmouseover="show(hint,hint1,400);"
   onmouseout ="hide(hint); return true;">


You are using |hint| in a way that only works in IE.

The W3C-standard way to access an HTML element with id="hint" is to
do |document.getElementById("hint")|. By using the id without any
qualification, as above, you are expecting that the HTML id has
somehow become a global variable in the JavaScript for the page.

This works in IE, because IE automatically puts every HTML id into the 
JavaScript namespace, so you can just say |hint| instead of 
|document.getElementById("hint")|.

This is not W3C-standard, however, and Mozilla does not support this. 
Have to mark this one invalid, because Mozilla is following the standard,
and the HTML here is relying on IE-only syntax.

The way to proceed would be to have an explicit declaration in JavaScript:

          var hint = document.getElementById("hint");


But I still see problems with your script. Here is the show() function:

function show(objeto,mensaje,width)
{
  tabla="<table  etc. etc."

  if(isNetscape)
  {
    objeto.document.write(tabla);
    objeto.document.close();

             etc.


In Mozilla, <div> elements don't have a |document| property.
But I can confirm that your page works in NN4.7, so I'm a little
puzzled by that. In Mozilla, you should do this instead:

                  hint.innerHTML = tabla
Status: UNCONFIRMED → RESOLVED
Closed: 23 years ago
Resolution: --- → INVALID
Sorry, inside the function that would be:

                   objeto.innerHTML = tabla
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: