HTML, JavaScript And CSS Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsProgrammingHTML, JavaScript And CSS Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old June 30th, 2008, 03:17 PM
todd2006 todd2006 is offline
Contributing User
ASP Free Beginner (1000 - 1499 posts)
 
Join Date: Apr 2006
Posts: 1,136 todd2006 User rank is Lance Corporal (50 - 100 Reputation Level)todd2006 User rank is Lance Corporal (50 - 100 Reputation Level)todd2006 User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 1 Week 6 Days 14 h 27 m 24 sec
Reputation Power: 4
Show hide div problem

Hi,

I have a drop down which has 3 values when one of them is selected I want to show content related to that value
in a div

when the page is first loaded I dont want to show any of the div's

Can someone tell me what i am doing wrong when the page is loaded first it displays the credit card div
and when i choose the options it doesnt give any error messages but it doesnt change the div's

Code:

Default
here is the code

Code:

<%
Option Explicit
Dim ReserveDisplaycredit, ReserveDisplaycash, ReserveDisplaycheck


ReserveDisplaycredit = "none"
ReserveDisplaycash = "none"
ReserveDisplaycheck = "none"

Response.write "ReserveDisplaycredit:-" & ReserveDisplaycredit & "<br/>"
Response.write "ReserveDisplaycash" & ReserveDisplaycash & "<br/>"
Response.write "ReserveDisplaycheck" & ReserveDisplaycheck & "<br/>"

%>
<head>
<title>Main</title>

<script type="text/javascript">
<!--
function getStyleObject(objectId)
{ 
	if (document.getElementById && document.getElementById(objectId))
		{
			return document.getElementById(objectId).style;
		}
	else if (document.all && document.all(objectId))
		{
		return document.all(objectId).style;
		}
	else
		{
		return false;
		}
}

function calloptionpay()
{
var sel_payway = document.getElementById("payway")
var getpayway = sel_payway.options[sel_payway.selectedIndex].text
alert(getpayway);

			
if(getpayway=="Cash")
{
alert("are we here");
hidecredit();
hidecheck();
changeDivcash('reservecash', 'block'); 
}
else if (getpayway=="Check")
{
hidecredit();
hidecash();
changeDivcheck('reservecheck', 'block'); 
}
else if (getpayway=="Credit Card")
{

hidecheck();
hidecash();
changeDivcredit('reservecredit', 'block'); 

}


}

function changeDivcash(the_div,the_change)
 {
	var the_style = getStyleObject(the_div);
	if (the_style != false)
		{
			the_style.display = the_change;
		}
  }

  function changeDivcredit(the_div,the_change)
 {
 alert("change credit");
	var the_style = getStyleObject(the_div);
	if (the_style != false)
		{
			the_style.display = the_change;
		}
  }

  function changeDivcheck(the_div,the_change)
 {
  alert("change check");
	var the_style = getStyleObject(the_div);
	if (the_style != false)
		{
			the_style.display = the_change;
		}
  }


function hidecheck()
 {
  alert("hide check");
	changeDivcheck("reservecheck", "none");
 }

 function hidecash()
 {
	changeDivcash("reservecash", "none");
 }

 function hidecredit()
 {
 alert("hide credit");
	changeDivcredit("reservecredit", "none");
 }


//form Validation ends 
// -->
</script>

</head>
<body>

<form name="frm1" id="frm1" method="post"  action="confirm.asp"> 


<table>


<td>Payment Method:</td>
<td><select name="payway" id="payway" onChange="calloptionpay();">
<option value="">Select the Payment Type</option>
<option value="Cash">Cash</option>
<option value="Check">Check</option>
<option value="Credit Card">Credit Card</option>
</select>
</td>
</tr>

<div id="reservecash" style="display: <%=ReserveDisplaycash%>;">
Cash
</div>

<div id="reservecheck" style="display: <%=ReserveDisplaycheck%>;">
check
</div>


<div id="reservecredit" style="display: <%=ReserveDisplaycredit%>;">
credit
</div>

<%
Response.write "ReserveDisplaycredit:-" & ReserveDisplaycredit & "<br/>"
Response.write "ReserveDisplaycash" & ReserveDisplaycash & "<br/>"
Response.write "ReserveDisplaycheck" & ReserveDisplaycheck & "<br/>"

%>


</body>
</html>
Comments on this post
ChiefWigs1982 disagrees!

Reply With Quote
Reply

Viewing: ASP Free ForumsProgrammingHTML, JavaScript And CSS Help > Show hide div problem


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway