SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Wizard
    Join Date
    Jun 2005
    Posts
    1,438
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question Can't work out how to amend this ?

    Have been trying to amend the code below to take out all options for 6 monthly and getting stuck - can anyone advise please
    Code:
    <script language="javascript">
    var rdVal='M';
    function selPrice(x)
    {
    rdVal=x;
    	if(x=="M")
    	{
    	document.getElementById("monthRate").style.display='';
    	document.getElementById("6monthRate").style.display='none';
    	document.getElementById("yearRate").style.display='none';
    	
    	document.getElementById("a3").value=document.getElementById("monthRate").value;
    	document.getElementById("p3").value='1'; //Monthly
    
    
    	}
    	else if(x=="Y")
    	{
    	document.getElementById("monthRate").style.display='none';
    	document.getElementById("6monthRate").style.display='none';
    	document.getElementById("yearRate").style.display='';
    
    	document.getElementById("a3").value=document.getElementById("yearRate").value;
    	document.getElementById("p3").value='1'; //Yearly
    	}
    	
    	else if(x=="M6")
    	{
    	document.getElementById("monthRate").style.display='none';
    	document.getElementById("6monthRate").style.display='';
    	document.getElementById("yearRate").style.display='none';
    
    	document.getElementById("a3").value=document.getElementById("6monthRate").value;
    	document.getElementById("p3").value='6'; //6 Monthly
    	}
    }
    
    function chkVal()
    {
    	if(rdVal=="M")
    	{
    	document.getElementById("a3").value=document.getElementById("monthRate").value;
    	document.getElementById("p3").value='1'; //Monthly
    	}else if(rdVal=="Y")
    	{
    	document.getElementById("a3").value=document.getElementById("yearRate").value;
    	document.getElementById("p3").value='1'; //Yearly
    	}
    	else if(rdVal=="M6")
    	{
    	document.getElementById("a3").value=document.getElementById("6monthRate").value;
    	document.getElementById("p3").value='6'; //6 Monthly
    	
    	}
    
    }
    </script>

  2. #2
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,702
    Mentioned
    101 Post(s)
    Tagged
    4 Thread(s)
    Can you please show us the HTML code that the script works with, or even better, link us through to a test page on the web that demonstrates the problem.
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •