Tempermental code

D

Daniel

Hello,

I am trying to make a simple function to hide or not a field based on
the selection made in a select input.

The following will work fine.
function enableAIBQ(EleName,EleVal)
{

if (EleVal != 1)
alert ("No");
else
alert ("Yes");
document.usrsel["IaibqNo"].style.visibility = "visible";
document.usrsel["IaibqNo"].focus();
}

However when I add in one line it stops working altogether???
function enableAIBQ(EleName,EleVal)
{

if (EleVal != 1)
alert ("No");
document.usrsel["IaibqNo"].style.visibility = "hidden";
else
alert ("Yes");
document.usrsel["IaibqNo"].style.visibility = "visible";
document.usrsel["IaibqNo"].focus();
}

Could someone show me my mistake or propose a solution.

Thank you

Daniel
 
S

Stevo

Daniel said:
However when I add in one line it stops working altogether???
function enableAIBQ(EleName,EleVal)
{

if (EleVal != 1)
alert ("No");
document.usrsel["IaibqNo"].style.visibility = "hidden";
else
alert ("Yes");
document.usrsel["IaibqNo"].style.visibility = "visible";
document.usrsel["IaibqNo"].focus();
}

Could someone show me my mistake or propose a solution.

function enableAIBQ(EleName,EleVal)
{
if (EleVal != 1)
{
alert ("No");
document.usrsel["IaibqNo"].style.visibility = "hidden";
}
else
{
alert ("Yes");
document.usrsel["IaibqNo"].style.visibility = "visible";
document.usrsel["IaibqNo"].focus();
}
}
 
D

Daniel

Daniel said:
However when I add in one line it stops working altogether???
function enableAIBQ(EleName,EleVal)
{
if (EleVal != 1)
alert ("No");
document.usrsel["IaibqNo"].style.visibility = "hidden";
else
alert ("Yes");
document.usrsel["IaibqNo"].style.visibility = "visible";
document.usrsel["IaibqNo"].focus();
}
Could someone show me my mistake or propose a solution.

function enableAIBQ(EleName,EleVal)
{
if (EleVal != 1)
{
alert ("No");
document.usrsel["IaibqNo"].style.visibility = "hidden";
}
else
{
alert ("Yes");
document.usrsel["IaibqNo"].style.visibility = "visible";
document.usrsel["IaibqNo"].focus();
}



}- Hide quoted text -

- Show quoted text -

Thank you! Thank you! Thank you!

Now I feel like an idiot for even having had to ask. I've been
staring at this code for to long and missed the obvious.

Daniel
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,159
Messages
2,570,879
Members
47,413
Latest member
ReeceDorri

Latest Threads

Top