Open Bug 322158 Opened 15 years ago Updated 2 years ago

Cannot set the text of a script element with javascript. Worked before I upgraded to 1.5


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

Windows XP





(Reporter: jwilsons, Unassigned)



(1 file)

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8) Gecko/20051111 Firefox/1.5
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8) Gecko/20051111 Firefox/1.5

I am using javascript to dynamically add a script element to the head of a page.  In Firefox prior to 1.5 it was working, after 1.5 it does not work.

This is my javascript
// add clocks
clock = document.createElement('script');
//clock.language = 'javascript';
clock.type = 'text/javascript';
// = 'clockHolder'+equipmentID;
var cDate = new Date();
var aEndTime = endTime.split(':');
if(aEndTime[0] == 0) aEndTime[0] = '24';
sOut = 'var cd'+equipmentID+' = new countdown(\'cd'+equipmentID+'\');';
clock.text = sOut;
document.getElementsByTagName( 'head' )[0].appendChild(clock);
eval('cd'+equipmentID).Div = 'clock'+equipmentID;
eval('cd'+equipmentID).TargetDate = cDate;
eval('cd'+equipmentID).DisplayFormat = '%%H%%:%%M%%:%%S%%';

I think it is a problem with the line clock.text = sOut;.  This line worked before and still works in IE.  I can see the script element just looks like there is nothing inside.  The first eval line gives me an error that the cd# is undefined.

Error: [JavaScript Error: "cd39 is not defined" {file: "http://localhost/ironglobe/include/BidBlock.js" line: 98}]
Source File: http://localhost/ironglobe/include/BidBlock.js
Line: 98


Reproducible: Always
Assignee: nobody → general
Component: General → DOM
Product: Firefox → Core
QA Contact: general → ian
Version: unspecified → Trunk
The problem is in the AddBidBlock function between lines 79-101.  The clock.text = sOut; does not add the string to the script element.  An error pops up when the script gets to line 98.  Says that variable cd? is not defined.
Assignee: general → nobody
QA Contact: ian → general

Move all DOM bugs that haven’t been updated in more than 3 years and has no one currently assigned to P5.

If you have questions, please contact :mdaly.
Priority: -- → P5
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.