Closed Bug 234093 Opened 21 years ago Closed 15 years ago

"Show Code" Button Doesn't Display Code (DHTML Issue)

Categories

(Tech Evangelism Graveyard :: English Other, defect)

x86
Windows XP
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: kevinbe71, Unassigned)

References

()

Details

(Whiteboard: [bug248549notfixed])

User-Agent:       
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.6) Gecko/20040206 Firefox/0.8

On this page, if you click "Show Code" then the browser does nothing.  If you
use IE 6.0 on the same page it works fine (the code is displayed).  The same
problem occurs with Mozilla 1.6.  So this appears to be a problem with Gecko.

Reproducible: Always
Steps to Reproduce:
1. Visit URL: http://www.dofactory.com/Patterns/PatternBridge.aspx
2. Click on "Show Code" button.
3. Observe that browser doesn't perform any action.

Actual Results:  
Nothing occurs, it should instead open up a hidden panel in the page that shows
the source code for the particular pattern.  This occurs the same on all pages
on the DoFactory.com patterns web site.

Expected Results:  
Opened up the hidden panel.
Got this error in JS console :

Error: RealWorld is not defined
Source File: http://www.dofactory.com/Patterns/PatternBridge.aspx
Line: 1030

And aroung line 1030 :

"<script Language="JavaScript">
<!--	

function ShowHide( ref )
{
   var color;
   if( ref == 'Structure' )
     color = 'aa0000';
   else
     color = '007733';
     
   if (eval(ref).style.display =='none')
   {
      eval('x' + ref).innerHTML = '<font face="Arial,helvetica" color=' + color
+ ' size=2><b><u>Hide code</u></b></font>';
      eval(ref).style.display ='';
   }
   else
   {
      eval('x' + ref).innerHTML = '<font face="Arial,helvetica" color=' + color
+ ' size=2><b><u>Show code</u></b></font>';
      eval(ref).style.display ='none';
   }   
}
//-->
</script>"

Line 1030 is :

if (eval(ref).style.display =='none')

Hope it helps :)
This is not a Gecko bug, here's a fixed version of the function that works in IE
and Gecko:

function ShowHide( ref )
{
   var color;
   if( ref == 'Structure' )
     color = 'aa0000';
   else
     color = '007733';
     
   var refElm = document.getElementById(ref);
   var xRefElm = document.getElementById('x' + ref);
   if (refElm.style.display =='none')
   {
      xRefElm.innerHTML = '<font face="Arial,helvetica" color=' + color + '
size=2><b><u>Hide code</u></b></font>';
      refElm.style.display ='';
   }
   else
   {
      xRefElm.innerHTML = '<font face="Arial,helvetica" color=' + color + '
size=2><b><u>Show code</u></b></font>';
      refElm.style.display ='none';
   }   
}
Confirming as Tech Evang.
Assignee: firefox → english-other
Status: UNCONFIRMED → NEW
Component: General → English Other
Ever confirmed: true
Product: Firefox → Tech Evangelism
QA Contact: english-other
Whiteboard: [bug248549notfixed]
fixed
Status: NEW → RESOLVED
Closed: 15 years ago
Resolution: --- → FIXED
Product: Tech Evangelism → Tech Evangelism Graveyard
You need to log in before you can comment on or make changes to this bug.