Wrox Programmer Forums
|
Javascript How-To Ask your "How do I do this with Javascript?" questions here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript How-To section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 25th, 2005, 11:33 AM
Friend of Wrox
 
Join Date: Jan 2005
Posts: 1,525
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to crmpicco Send a message via AIM to crmpicco Send a message via MSN to crmpicco Send a message via Yahoo to crmpicco
Default

function init()
{
    for (i = 0; i < document.forms[i].elements["out"].length; i++)
    {
        document.forms[i].elements["out"].disabled = false;
    }
}

that doesnt work

www.crmpicco.co.uk
 
Old February 25th, 2005, 11:52 AM
joefawcett's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

Nearly right, easier to use getElementsByName:
Code:
function init()
{
  var colRadio = document.getElementsByName("out");
  if (colRadio.length)
  {
    for (var i = 0; i < colRadio.length; i++)
    {
      colRadio[i].disabled = false;
    }
  }
  else
  {
    colRadio.disabled = false;
  }
}
--

Joe (Microsoft MVP - XML)
 
Old February 25th, 2005, 11:53 AM
Friend of Wrox
 
Join Date: Jan 2005
Posts: 1,525
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to crmpicco Send a message via AIM to crmpicco Send a message via MSN to crmpicco Send a message via Yahoo to crmpicco
Default

My code as it stands:

<script language="JavaScript" type="text/javascript">
function init()
{
    for (i = 0; i < document.forms[i].elements["out"].length; i++)
    {
        document.forms[i].elements["out"].disabled = false;
        alert ("No. of netfares = "+document.forms[i].elements["out"].length+"");
    }
}
</script>

Body:

<body bgcolor="#F5F5F5" onLoad="InitializeTimer();init();">

The radio button(s):

<input type="radio" name="out" onclick="javascript: oSeg('<%=depFareID%>','<%=depContractID%>','<%=rsC ont("air_cds")%>','<%=invalidClass%>', '<% if ConFlag = false and preisdirect = true then response.write via& ",*" & ",*" else response.write "*" end if%>','<%=preisdirect%>','<% if preisdirect = true then response.write preaddoncost else response.write "*" end if%>','<%= pre_addonRBD %>','<%= pre_addonCD %>','<%= conFlag %>');" DISABLED>

The alert give me the value '8' which is correct, but it doesnt enable the radio buttons when the page is loaded - the just stay disabled


www.crmpicco.co.uk
 
Old February 25th, 2005, 11:57 AM
Friend of Wrox
 
Join Date: Jan 2005
Posts: 1,525
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to crmpicco Send a message via AIM to crmpicco Send a message via MSN to crmpicco Send a message via Yahoo to crmpicco
Default

help MUCh appreciated

www.crmpicco.co.uk





Similar Threads
Thread Thread Starter Forum Replies Last Post
Radio button gaurisharya C# 2005 2 March 16th, 2008 06:43 AM
radio button anwarraja Javascript 3 September 18th, 2007 08:18 PM
Radio Button hoailing22 ASP.NET 1.0 and 1.1 Basics 1 June 2nd, 2005 12:08 AM
Button acts depending on radio button values janise Access 4 March 10th, 2004 12:53 AM
radio button damnnono_86 Access 5 October 28th, 2003 02:17 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.