Register Blogs FAQ Members List Social Groups Calendar Search Today's Posts Mark Forums Read

Go Back   DeveloperBarn Forums > Programming & Scripting > JavaScript Programming

Sponsored Links

Discuss "drop down problem" in the JavaScript Programming forum.

JavaScript Programming - Javascript is a cross-browser client-side scripting language. Discuss Javascript and AJAX related scripts here.


Reply
 
LinkBack Thread Tools Display Modes
  #31  
Old July 1st, 2008, 02:51 PM
richyrich's Avatar
Super Moderator
 
Join Date: Mar 2008
Location: Somewhere only we know...
Posts: 417
Thanks: 26
Thanked 34 Times in 34 Posts
Blog Entries: 1
Rep Power: 1
richyrich will become famous soon enough

Awards Showcase
JavaScript Classic ASP 
Total Awards: 2

Default

Quote:
Originally Posted by todd2006 View Post
Ok i found out whats going on

function changeDivcr(the_div,the_change)
{
alert(the_div);
alert(the_change);
document.getElementById(the_div).style.display=the _change;
}

when the alert is fired it always tells me reservecash

when i select credit card i still get the alert reservecash when it should be reservecredit
Then you can't be calling the JS function correctly. The div names must be enclosed in ' ' single quotes when calling the changeDiv function.

Quote:
Originally Posted by todd2006
document.getElementById('the_div').style.display=t he_change;
That can't be right because that's telling it to look for a div called the_div which doesn't exist.
Reply With Quote
Sponsored Links
  #32  
Old July 1st, 2008, 02:55 PM
Barn Frequenter
 
Join Date: Mar 2008
Posts: 197
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 1
todd2006 is an unknown quantity at this point
Default

Hi,

I am using this function

Code:
function calloptionpay()
{
var sel_payway = document.getElementById("payway")
var getpayway = sel_payway.options[sel_payway.selectedIndex].text
if(getpayway=="Cash")
{
changeDiv('reservecash','block');
changeDiv('reservecheck','none');
changeDiv('reservecredit','none');
}
else if (getpayway=="Check")
{
changeDiv('reservecash','none');
changeDiv('reservecheck','block');
changeDiv('reservecredit','none');
}
else if (getpayway=="Credit Card")
{
changeDiv('reservecash','none');
changeDiv('reservecheck','none');
changeDiv('reservecredit','block');
}
var creditcardflag
creditcardflag="Yes"
document.getElementById("creditcardflag").value = creditcardflag;
}
function changeDiv(the_div,the_change)
 {
document.getElementById('the_div').style.display=the_change;
  }

it works no errors but the divs dont change
Reply With Quote
  #33  
Old July 1st, 2008, 04:46 PM
richyrich's Avatar
Super Moderator
 
Join Date: Mar 2008
Location: Somewhere only we know...
Posts: 417
Thanks: 26
Thanked 34 Times in 34 Posts
Blog Entries: 1
Rep Power: 1
richyrich will become famous soon enough

Awards Showcase
JavaScript Classic ASP 
Total Awards: 2

Default

This line:-
Code:
document.getElementById('the_div').style.display=the_change;
should be:-
Code:
document.getElementById(the_div).style.display=the_change;
In your previous post the function seems to be called changeDivcr. Are you calling the correct function with the correct variables?

Last edited by richyrich; July 1st, 2008 at 04:50 PM.
Reply With Quote
Reply

  DeveloperBarn Forums > Programming & Scripting > JavaScript Programming

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
display problem with drop downs todd2006 JavaScript Programming 3 May 5th, 2008 05:31 PM
drop down problem todd2006 .Net Development 2 April 23rd, 2008 11:37 AM


All times are GMT -4. The time now is 07:54 PM.



Content Relevant URLs by vBSEO 3.2.0