5 pts.
 Functions in JavaScript
function pcs() { var t1=document.getElementById("tot1").value var pb=document.getElementById("pcbox").value var pc="" if(t1==! && pb==!) { document.getElementId("rbox").innerHTML="" } } My question is if the value t1 & pb = null means the function pcs() is not writern...How?

Software/Hardware used:
ASKED: January 23, 2009  12:48 PM
UPDATED: March 25, 2009  7:47 PM

Answer Wiki:
You need to test t1 and pb for null before accessing the value property, e.g. var t1 = document.getElementById("tot1"); var x; if (t1 != null) { x = t1.value; } The value property always returns a string, so it will never be null, because string objects return empty string but not null.
Last Wiki Answer Submitted:  March 25, 2009  7:47 pm  by  Czarp   300 pts.
All Answer Wiki Contributors:  Czarp   300 pts.
To see all answers submitted to the Answer Wiki: View Answer History.


Discuss This Question:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _