Hi Robert,
Just two questions?
1 - is it possible to call two functions from the onload event?
<body onload="doIt('test', 5)"; "testTrue()";>
2 - is it possible to set the target using code??
I know we can use the location.href = "test.htm" to create a link but what
about the target?? how do I set it?? this does not work:
location.href = "test.htm target='main'";
Cheers,
Claudio
> Hi Claudio,
I don't think that it regards the TABLE element as null.
parent.frames[1].rightBottom.document.getElementsByTagName("table") !=3D
null
Just check for :
parent.frames[1].rightBottom.document.getElementsByTagName("table")
or perhaps:
if(typeof
parent.frames[1].rightBottom.document.getElementsByTagName("table") =
=3D=3D
"object")
If this doesn't work, create a variable in the other frame that is set
to true when the page is fully loaded.
As in:
<html>
<head>
<title>A title</title>
<script language=3D"JavaScript" type=3D"text/javascript">
var bIsLoaded =3D false;
window.onload =3D function (){
bIsLoaded =3D true;
}
</script>
</head>
<body>
</body>
</html>
And then change:
if(parent.frames[1].rightBottom.document.getElementsByTagName("table")
!=3D null) {
to:
if(bIsLoaded)
/Robert
-----Ursprungligt meddelande-----
Fr=E5n: Pallone, Claudio [KMR-SPC] [mailto:Claudio.Pallone@k...]=20
Skickat: den 16 oktober 2002 15:55
Till: JavaScript HowTo
=C4mne: [javascript_howto] CHECK FOR NULL VALUE
Hi,
Two weeks ago Robert showed me how to create a function that would
highlight the <td>s of a table according to some criteria. This works
wonderfully well.
However, since I am using frames, I have to make sure that all the
frames are loaded. If the user clicks on the highlight button before the
bottom frame is loaded then I get an alert saying that the bottom frame
is null.
I have tried to use an "if" statement to check if the frame is null but
it is not working.
Any ideas why this "if" statement is not working?
Cheers,
var bColoredTDs =3D false;
function HighlightIndexTD()
{
if(parent.frames[1].rightBottom.document.getElementsByTagName("table")
!=3D null) {
var arrTables =3D
parent.frames[1].rightBottom.document.getElementsByTagName("table");
for(var i=3D0; i<arrTables.length; i++)
{
if(i > 0)
{
var arrAllCurrentTableRows =3D
arrTables[i].getElementsByTagName("tr");
for(var j=3D0; j<arrAllCurrentTableRows.length;
j++)
{
var oAllCells =3D
arrAllCurrentTableRows[j].getElementsByTagName("td");
with(oAllCells[oAllCells.length - 1])
{
var intValue =3D
parseInt(innerHTML, 10);
if(!bColoredTDs && (intValue <
80 || intValue > 120))
{
style.color =3D "white";
style.backgroundColor =3D
(intValue < 80)? "blue" : "red";
}
else
{
style.color =3D "black";
style.backgroundColor =3D
"white";
}
}
}
}
}
bColoredTDs =3D (bColoredTDs)? false : true;
else
{
alert("Choose a Report");
}
}
BMRB International=20
http://www.bmrb.co.uk +44 (0)20 8566 5000
____________________________________________________________
This message (and any attachment) is intended only for the recipient and
may contain confidential and/or privileged material. If you have
received this in error, please contact the sender and delete this
message immediately. Disclosure, copying or other action taken in
respect of this email or in reliance on it is prohibited. BMRB
International Limited accepts no liability in relation to any personal
emails, or content of any email which does not directly relate to our
business.
---
Improve your web design skills with these new books from Glasshaus.
Usable Web Menus
http://www.amazon.com/exec/obidos/ASIN/1904151027/ref=3Dnosim/theprogramm=
e
r-20
Constructing Accessible Web Sites
http://www.amazon.com/exec/obidos/ASIN/1904151000/ref=3Dnosim/theprogramm=
e
r-20
Practical JavaScript for the Usable Web
http://www.amazon.com/exec/obidos/ASIN/1904151051/ref=3Dnosim/theprogramm=
e
r-20
---
Change your mail options at http://p2p.wrox.com/manager.asp or=20
to unsubscribe send a blank email to