Connecting Tech Pros Worldwide Forums | Help | Site Map

function that can change a global var

ViperG@gmail.com
Guest
 
Posts: n/a
#1: Jan 11 '07
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?


Lee
Guest
 
Posts: n/a
#2: Jan 11 '07

re: function that can change a global var


ViperG@gmail.com said:
Quote:
>
>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);
}


--

ViperG@gmail.com
Guest
 
Posts: n/a
#3: Jan 11 '07

re: function that can change a global var


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?

Closed Thread