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

RESOLVED FIXED

Status

Tech Evangelism Graveyard
English Other
RESOLVED FIXED
15 years ago
3 years ago

People

(Reporter: Kevin Berry, Unassigned)

Tracking

Details

(Whiteboard: [bug248549notfixed], URL)

(Reporter)

Description

15 years ago
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.

Comment 1

15 years ago
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 :)

Comment 2

15 years ago
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';
   }   
}

Comment 3

15 years ago
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

Updated

14 years ago
Whiteboard: [bug248549notfixed]
fixed
Status: NEW → RESOLVED
Last Resolved: 10 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.