The javascript would probably need to be in textField2's events, maybe the exit event. When textField2 is exited, the event will execute.
textField2 Exit event javascript
switch(textField2.rawValue)
{
case 1: //if textField is 1 when exited, execute this code
textField1.presence = "visible";
break;
case 2: //if textField is 1 when exited, execute this code
textField1.presence = "invisible";
break;
default: //this code runs when the above logic is not met
//put code here that executes if when textField2 is exited, the rawValue isn't 1 or 2.
break;
}