function that can change a global var

L

Lee

(e-mail address removed) said:
I need some help, I can't get this to work ->

http://www.all4computers.net/webpages/apply.html

When I try to change Loan Purpose to Finance, it's suppose to change
show to 1, else it's 0.

But Show is always 0. Can someone help me please?

The global variable "show" is changing to 1.
You won't see that in your document.write(), because that only executes as the
page is loading, while show is still 0.
Don't try to debug with document.write(). Use alert(), instead:

function displayr()
{
var main = document.forms['mainform']['Purpose'];
var refine = document.forms['mainform']['Refinance'];

if (main.options[main.selectedIndex].value == "refinance") {
refine.style.display = 'inline';
show=1;
} else {
refine.style.display = 'none';
show=0;
}
alert(show);
}


--
 
V

ViperG

Ok Thanks, I see.

Well what I'm trying to do is when the user picks refinance, another
form becomes visible, and if not it hides. I have that part figured out
as you can see, but I still have the problem of it displaying some of
the html that goes with that form, I want to hide that also. How would
I go about hiding/showing certain html on the page?
 

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,431
Messages
2,571,677
Members
48,796
Latest member
Greg L.

Latest Threads

Top