alert() window does not work from external JS file

P

pnberry

Hello,

I was doing some testing with a JavaScript file that is loaded as an
external library. I like to use alert() windows to test or see values
as I do development work but I found that when the alert() function is
used from the external library file it doesn't work. But when I moved
the same code back into the <head></head> section of my web page the
alert() windows did work. What is going on here? (I'm using firefox
2.0.0.8)

Paul

Original section of my .php web page where the alert windows didn't
work:
snip------------------------------------>
print '<html>';
print '<head>';
#JavaScript code and CSS formatting to highlight the "Update row"
print '<script src="tr_javascript.js" type="text/javascript"></
script>';
print '<link rel="stylesheet" type="text/css"
href="tr_stylsheet.css">';
print '</head>';
snip------------------------------------>

tr_javascript.js:
/* JavaScript for Transaction form
* selectRow function borrowed from comp.lang.javascript usergroup
* causes background and font color to change when row is selected.
*/
//objCurrentRowSelected is a 'object HTML TableRowElement'
var objCurrentRowSelected = null;
function selectRow(objRow,rownum) {
if (objRow != objCurrentRowSelected) { //clicked row != row already
highlighted
if (objCurrentRowSelected) { //clicked row is not null
objCurrentRowSelected.className = ""; //current row is de-
highlighted
}
//new row is highlighted
objCurrentRowSelected = objRow;
objCurrentRowSelected.className = "selected";
}

//Statements for identifying which row was selected and passing the
value to php
//via the value of a hidden form field
var row_number = document.getElementById("row_number");
row_number.value = rownum;
alert(rownum);
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,070
Latest member
BiogenixGummies

Latest Threads

Top