phentalmyst
Programmer
hi folks,
i have a table cell that im wanting to keep track of the innerText of, and the code i wrote isnt working properly. i dont think im referencing the text accurately and havent been able to find the solution.
here's my code:
<html>
<head>
<title>New Page 1</title>
<script language="javascript">
<!--
function checkHeight(){
if(document.all.test.innerText > 2){document.write ("YAY"
} else {document.write ("sorry, try again"}
}
//-->
</script>
</head>
<body onLoad="checkHeight()">
<center>
<table id="test" border="0" cellpadding="0" cellspacing="0" width="200">
<tr>
<td>kjasdlfkj<br>
Asdf<br>
asdf<br>
Asdf<br>
Asdf</div></td>
<td></td>
</tr>
<tr>
<td></td>
<td></td>
</tr>
</table>
</center>
</body>
</html>
what's supposed to happen is if there's more than 2 characters of text in the cell, you get a YAY doc-write, but if not, you get a SORRY doc-write.
any suggestions?
thanks!
i have a table cell that im wanting to keep track of the innerText of, and the code i wrote isnt working properly. i dont think im referencing the text accurately and havent been able to find the solution.
here's my code:
<html>
<head>
<title>New Page 1</title>
<script language="javascript">
<!--
function checkHeight(){
if(document.all.test.innerText > 2){document.write ("YAY"
} else {document.write ("sorry, try again"}
}
//-->
</script>
</head>
<body onLoad="checkHeight()">
<center>
<table id="test" border="0" cellpadding="0" cellspacing="0" width="200">
<tr>
<td>kjasdlfkj<br>
Asdf<br>
asdf<br>
Asdf<br>
Asdf</div></td>
<td></td>
</tr>
<tr>
<td></td>
<td></td>
</tr>
</table>
</center>
</body>
</html>
what's supposed to happen is if there's more than 2 characters of text in the cell, you get a YAY doc-write, but if not, you get a SORRY doc-write.
any suggestions?
thanks!