Buttons visibility is set to hidden to start. Suggestions?

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

<body onLoad="CKPMT1()">

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

Try this:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>Airshow :: Untitled</title>
<style type="text/css">
.hidden { visibility: hidden; }
</style>
<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.
}
</script>
</head>
<body>
<form name="Form1">
	<input name="BalPmtPayee"><br />
	<input class="hidden" type="button" name="B1" value="MyButton">
</form>
</body>
</html>

Airshow

<script type='text/javascript'> language= is deprecated

<script type='text/javascript'> language= is deprecated

Thanks A-B, my mistake.

Airshow

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

Aha ASP! No further explanation is required.

Airshow

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';} }
//-->
</script>
<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.

Airshow

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.