Buttons visibility is set to hidden to start. Suggestions?

<script Language="JavaScript">
Function CKPMT1()
Var PMT1;
   PMT1 = document.Form1.BalPmtPayee.value;
IF PMT1 = ""  then ;
End if
End Function

<body onLoad="CKPMT1()">
8 Years
Discussion Span
Last Post by Airshow

I have to say, that's absolutely nothing like javascript Nuttdude.

Try this:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
<title>Airshow :: Untitled</title>
<style type="text/css">
.hidden { visibility: hidden; }
<script Language="JavaScript">
function formVisibles(){
	document.Form1.B1.style.visibility = (document.Form1.BalPmtPayee.value == "") ? 'hidden' : 'visible';//-- reverse hidden|visible for opposite logic.
	//-- perform further form element visibilities here.
onload = function(){
	var ips = document.Form1.getElementsByTagName('input');//-- array of all input fields in Form1.
	for(var i=0; i<ips.length; i++){
		ips[i].onblur = function(){
			formVisibles();//-- call formVisibles when user exits each input field.
			//-- add further onblur actions here
	//-- attach further form event handlers here.
<form name="Form1">
	<input name="BalPmtPayee"><br />
	<input class="hidden" type="button" name="B1" value="MyButton">



Thx for the relply Airshow. This is embeded in an asp doc so that is why it is not a full page in javascript.


and in 'other browsers' the css may not work
mozilla dom and IE dom use different,
there may be some failure
this is a javascript for setting visibility in both major dom

<script type="text/javascript">
(document.getElementById) ? dom = true : dom = false;
function hideIt(id) {
 if (dom) {document.getElementById(id).style.visibility='hidden';}
 if (document.layers) {document.layers[id].visibility='hide';} }
function showIt() {
 if (dom) {document.getElementById(id).style.visibility='visible';}
 if (document.layers) {document.layers[id].visibility='show';} }
<a href='*' onclick='hideIt("thisdiv")' >Hide thisdiv</a>
<div id='thisdiv'>this text should hide aor reappear onclicking the link</div>
<a href='*' onclick='showIt("thisdiv")' >Show thisdiv</a>

and it may not work all the time either, (damn safari)


Used to more of a problem than it is now Bob. The major players have converged on the W3C standard visibility : visible | hidden .

I just tested my code above in the latest FF and Opera and it works fine. In fact they both throw a js error is you try show | hide. I don't have the equipment to test Safari but the Safari SCC Reference certainly indicates that visible | hidden should work.

Agreed there may still be a few older versions of Moz etc. around but personally I wouldn't bother with show | hide any more .... unless there's something I don't know, which is always possible.


This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.