473,796 Members | 2,652 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Urgent: Why doesn't this work - dynamically created radio buttons

I create a table containing radiobuttons in client script depending on
what choices the user makes.
It works fine the radio buttons appear *but* they are *not clickable*.
Why? Is there a solution?
I'm using IE 6.0

cheers,
mortb

actual code included (cut from a larger page):

<script language='javas cript'>
var GUIArr = new Array(new Array('gui1',36 ,'type1',16,16) , new
Array('gui2',37 ,'type1',16,16) )
</script>
<html>
<body>
<form>
<script language="javas cript">
function populateGUIRadi oList()
{
var table =
document.frmIco n.getElementByI d("radioTab") ;
// alert(table.row s.length);
//alert(document. getElementById( "searchGUIType" ).value)
var TRs = table.getElemen tsByTagName("tr ");
// alert(TRs.lengt h);
var len = TRs.length;
for(i=0;i < len; i++)
{
table.deleteRow ();
}
var GUIType =
document.getEle mentById("searc hGUIType").valu e;
var GUIWidth =
document.getEle mentById("searc hGUIWidth").val ue.replace(/[^0-9]./,
"");
var GUIHeight =
document.getEle mentById("searc hGUIHeight").va lue.replace(/[^0-9]./,
"");
//alert(document. getElementById( "searchGUIType" ).value);
for(i = 0; i < GUIArr.length; i ++)
{
if((GUIType == "" ||GUIType == GUIArr[i][2])
&& (GUIWidth == "" ||GUIWidth == GUIArr[i][3])
&& (GUIHeight == "" ||GUIHeight ==
GUIArr[i][4]))
{
var row =
table.insertRow ();//document.create Element("tr");
var cell = document.create Element("td");
var text =
document.create TextNode(GUIArr[i][0] + " - " + GUIArr[i][2] + " " +
GUIArr[i][3] + " x " + GUIArr[i][4]);
var rdbtn =
document.create Element("input" );
rdbtn.type = "radio";
rdbtn.value = GUIArr[i][1];
rdbtn.name = "displayGUIObje ct";
cell.appendChil d(rdbtn);
cell.appendChil d(text);
row.appendChild (cell);
}
}
}
</script>
<input type="text" id="searchGUIWi dth" maxlength="4"
size="4" onkeyup="popula teGUIRadioList( )"> x
<input type="text" id="searchGUIHe ight" maxlength="4"
size="4" onkeyup="popula teGUIRadioList( )">
<select id="searchGUITy pe"
onchange="popul ateGUIRadioList ()">
<option value="">&lt;Al l types&gt;</option>
<option value="type1">t ype1</option>
<option value="<= 256 Colors">Icon &lt;=256</option>
<option value="> 256 Colors">Icon &gt;256</option>
</select>
<table id="radioTab">
</table>
</form>
</body>
</html>
Jul 23 '05 #1
2 2095
Sorry I've posted the wrong version previously.
This is the right one, but the radio buttons still don't work

/mortb
<script language='javas cript'>
var GUIArr = new Array(new Array('gui1',36 ,'type1',16,16) , new
Array('gui2',37 ,'type1',16,16) )
</script>
<html>
<body>
<form>
<script language="javas cript">
function populateGUIRadi oList()
{
var table = document.getEle mentById("radio Tab");
// alert(table.row s.length);
//alert(document. getElementById( "searchGUIType" ).value)
var TRs = table.getElemen tsByTagName("tr ");
// alert(TRs.lengt h);
var len = TRs.length;
for(i=0;i < len; i++)
{
table.deleteRow ();
}
var GUIType =
document.getEle mentById("searc hGUIType").valu e;
var GUIWidth =
document.getEle mentById("searc hGUIWidth").val ue.replace(/[^0-9]./,
"");
var GUIHeight =
document.getEle mentById("searc hGUIHeight").va lue.replace(/[^0-9]./,
"");
//alert(document. getElementById( "searchGUIType" ).value);
for(i = 0; i < GUIArr.length; i ++)
{
if((GUIType == "" ||GUIType == GUIArr[i][2])
&& (GUIWidth == "" ||GUIWidth == GUIArr[i][3])
&& (GUIHeight == "" ||GUIHeight ==
GUIArr[i][4]))
{
var row =
table.insertRow ();//document.create Element("tr");
var cell = document.create Element("td");
var text =
document.create TextNode(GUIArr[i][0] + " - " + GUIArr[i][2] + " " +
GUIArr[i][3] + " x " + GUIArr[i][4]);
var rdbtn =
document.create Element("input" );
rdbtn.type = "radio";
rdbtn.value = GUIArr[i][1];
rdbtn.name = "displayGUIObje ct";
cell.appendChil d(rdbtn);
cell.appendChil d(text);
row.appendChild (cell);
}
}
}
</script>
<input type="text" id="searchGUIWi dth" maxlength="4"
size="4" onkeyup="popula teGUIRadioList( )"> x
<input type="text" id="searchGUIHe ight" maxlength="4"
size="4" onkeyup="popula teGUIRadioList( )">
<select id="searchGUITy pe"
onchange="popul ateGUIRadioList ()">
<option value="">&lt;Al l types&gt;</option>
<option value="type1">t ype1</option>
<option value="<= 256 Colors">Icon &lt;=256</option>
<option value="> 256 Colors">Icon &gt;256</option>
</select>
<table id="radioTab">
</table>
</form>
</body>
</html>
Jul 23 '05 #2
mortb wrote:
Sorry I've posted the wrong version previously.
This is the right one, but the radio buttons still don't work

/mortb
<script language='javas cript'>
var GUIArr = new Array(new Array('gui1',36 ,'type1',16,16) , new
Array('gui2',37 ,'type1',16,16) )
</script>
<html>
<body>
<form>
<script language="javas cript">
function populateGUIRadi oList()
{
var table = document.getEle mentById("radio Tab");
// alert(table.row s.length);
//alert(document. getElementById( "searchGUIType" ).value)
var TRs = table.getElemen tsByTagName("tr ");
// alert(TRs.lengt h);
var len = TRs.length;
for(i=0;i < len; i++)
{
table.deleteRow ();
}
var GUIType =
document.getEle mentById("searc hGUIType").valu e;
var GUIWidth =
document.getEle mentById("searc hGUIWidth").val ue.replace(/[^0-9]./,
"");
var GUIHeight =
document.getEle mentById("searc hGUIHeight").va lue.replace(/[^0-9]./,
"");
//alert(document. getElementById( "searchGUIType" ).value);
for(i = 0; i < GUIArr.length; i ++)
{
if((GUIType == "" ||GUIType == GUIArr[i][2])
&& (GUIWidth == "" ||GUIWidth == GUIArr[i][3])
&& (GUIHeight == "" ||GUIHeight ==
GUIArr[i][4]))
{
var row =
table.insertRow ();//document.create Element("tr");
var cell = document.create Element("td");
var text =
document.create TextNode(GUIArr[i][0] + " - " + GUIArr[i][2] + " " +
GUIArr[i][3] + " x " + GUIArr[i][4]);
var rdbtn =
document.create Element("input" );
rdbtn.type = "radio";
rdbtn.value = GUIArr[i][1];
rdbtn.name = "displayGUIObje ct";
cell.appendChil d(rdbtn);
cell.appendChil d(text);
row.appendChild (cell);
}
}
}
</script>
<input type="text" id="searchGUIWi dth" maxlength="4"
size="4" onkeyup="popula teGUIRadioList( )"> x
<input type="text" id="searchGUIHe ight" maxlength="4"
size="4" onkeyup="popula teGUIRadioList( )">
<select id="searchGUITy pe"
onchange="popul ateGUIRadioList ()">
<option value="">&lt;Al l types&gt;</option>
<option value="type1">t ype1</option>
<option value="<= 256 Colors">Icon &lt;=256</option>
<option value="> 256 Colors">Icon &gt;256</option>
</select>
<table id="radioTab">
</table>
</form>
</body>
</html>


Doesn't do anything here in either IE6SP1 or Firefox 0.9.1.

Usually it's best to break the problem down into the simplest example that
demonstrates the behaviour you are seeing. Doing this allows people to help you,
it sometimes also allows you to pinpoint the problem yourself.

Also, although it has nothing to do with your problem, <script> should always
appear inside <head></head> or <body></body>. Specifying <script> tags outside
of everything, including the <html> tags allows some user agents to completely
ignore the code (although that is not the case with the more popular user
agents, it's still a bad design choice).

So provide a working example and someone may be able to assist you.

--
| Grant Wagner <gw*****@agrico reunited.com>

* Client-side Javascript and Netscape 4 DOM Reference available at:
*
http://devedge.netscape.com/library/...ce/frames.html

* Internet Explorer DOM Reference available at:
*
http://msdn.microsoft.com/workshop/a...ence_entry.asp

* Netscape 6/7 DOM Reference available at:
* http://www.mozilla.org/docs/dom/domref/
* Tips for upgrading JavaScript for Netscape 7 / Mozilla
* http://www.mozilla.org/docs/web-deve...upgrade_2.html
Jul 23 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
4427
by: Steve Black | last post by:
Hello, I am dynamically creating checkboxes on my web page based on data in a SQL Server table. Therefore, these checkboxes do not exist at design time and I cannot refer to them in my server-side code at design time. Once the page is submitted, how can I access these checkboxes in my code-behind? Thanks for the help,
1
3325
by: Karthick Kumar | last post by:
Hi, I have the following code which displays all the images from a specific folder with a Radio button in it: Dim objFile i = 1 For Each objFile In objFolder.Files If (i = 1) Then Response.Write("<TR>")
10
2376
by: Jay | last post by:
Good afternoon, I have a radio list box called rblNavigateOptions and I need to be able to simply set one of those radio items to disabled before any item is selected by a user. ie. When the rblNavigateOptions control is created one or some of the items it contains are disabled.
2
11983
by: James P. | last post by:
Help, I need to display radio buttons on a form. The data is from SQL table: each row in each table is displayed as a radio button. I have multiple SQL tables so I understand I need to put them each in a GroupBox. All the examples I saw from the books or from the web show me how to add static radio buttons at design, or dynamically at run time but with fixed radio buttons (like from an array). I need to create radio buttons based...
2
1697
by: epigram | last post by:
I'm dynamically creating a number of radio buttons on my aspx page based upon data read from a db. Each radio button has autopostback turned on. I'm experiencing two problems. 1) I am reading the db, creating the radio buttons, and setting the checked property (also based upon data in the db) in Page_Load regardless of whether a postback is occurring or not. The page loads and displays correctly each time unless the database is updated...
7
13640
by: deepagulati | last post by:
Hi, I need an urgent help from you. When we dynamically genrate any list box (Select Box) it shows one default value as selected. Is there any way that we can deselect that value. I tried with document.form_Name.ListBox_Name.options.selected =
5
12555
by: sam | last post by:
Hi all, I am dynamically creating a table rows and inerting radio buttons which are also dynamically created. Everything works fine in Firefox as expected. But I am not able to select radio buttons in IE. It does not even throw any errors. I have searched over the net but could not find anyhelp. Hope some experts here could help me. Here is part my code that dynamically generates the radio buttons, I cannot paste the entire code as it is...
7
4876
by: moksha | last post by:
Hi, I am new to javascript and i am facing a problem in coding. plz help me out. I am using javascript for dynamically creating a table row which contains text boxes and radio buttons and check box. I am adding two radio buttons once for a row.Now my problem is the radio buttons in all the rows that added dynamically are behaving as same group i.e when i am selecting a radio button in second row,radio button in first row...
5
6706
by: satyabhaskar | last post by:
hi all, In my web page i have created radio buttons dynamically on to the page .....following is my code string Course, Semester, Section; int rowsCount; string con = ConfigurationManager.ConnectionStrings.ConnectionString; protected void Page_Load(object sender, EventArgs e) { try
0
9673
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9524
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10449
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10217
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10168
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9047
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6785
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5440
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
3730
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.