Hello,
I am trying to add 2 RadioButtons in a form in js dynamically. I can see 2 radiobutttons, but no text. On clicking them, their is no selection. One of them is selected. I need to retrive their vakue on button click. The form is added in a div which is present in html form (that is not dynamically created). Form & all other elements are created dynamically & appended to div elemetn whch is present in html. The code is : -
-
var miles=document.createElement("input");
-
miles.setAttribute("type", "radio");
-
miles.setAttribute("id", "miles");
-
miles.setAttribute("value", "miles");
-
miles.setAttribute("checked", "true");
-
miles.setAttribute("name", "units");
-
-
var km=document.createElement("input");
-
km.setAttribute("type", "radio");
-
km.setAttribute("id", "km");
-
km.setAttribute("value", "km");
-
km.setAttribute("checked", "false");
-
km.setAttribute("name", "units");
-
-
var getVal=function(){
-
scaleUnits=document.forms['dynamicForm'].elements['radio'].value;
-
alert(scaleUnits);
-
driveFrom=document.forms['dynamicForm'].elements['fromTxt'].value;
-
driveTo=document.forms['dynamicForm'].elements['toTxt'].value;
-
GetDirections(driveFrom, driveTo);
-
} //this sets up a function in the same scope as the onclick assignment that will use it.
-
getDirectionsBtn.onclick=getVal; //this assigns the function to the element.
-
Regarding TExt Area:-
Based on the above form, I want to add a TextArea via another function. The code is :- -
function DoAlert(text) {
-
var d=document.getElementById("directDIV");
-
var e=document.getElementById("dynamicForm");
-
d.style.visibility="visible";
-
// var dynamicForm=document.createElement("form");
-
// dynamicForm.setAttribute("id", "dynamicForm");
-
// dynamicForm.setAttribute("runat", "server");
-
-
var textTA=document.createElement("textarea");
-
textTA.setAttribute("id", "textTA");
-
textTA.setAttribute("overflow", "auto");
-
textTA.setAttribute("rows", "30");
-
textTA.innerHTML=text;
-
-
e.appendChild(textTA);
-
// d.insertBefore(dynamicForm, lbl);
-
}
This gives me error on textTA.innerHTM L line. If this is incorrect, then how do i add contents to the text area.
Help me guys.
Thank
Trupti
1 1962 pbmods 5,821
Recognized Expert Expert
This gives me error on textTA.innerHTM L line. If this is incorrect, then how do i add contents to the text area.
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Arun Nair |
last post by:
Hi,
I have the following jsp page. I am able to view only a part of
it(until the occurence of the first City text box). If i remove the
first few fields from the page, I am able to see a few more fields at
the bottom.
My form class contains all the properties that are used in the jsp
page.
I don't know what I am doing wrong. I am using struts1.1 & JDK
1.4.2.
|
by: Dave |
last post by:
Hi,
there used to be a simple javascript quiz builder in builder.com, with
which I made the page whose code is given below.
I would like to tweak this so that there are only three (not 4) answer
options, and that they are presented alongside radio buttons (not in a
selectable list). I would be grateful if someone knows how to do this
for me. It would be nice if the student doing the quiz selects the
right answer with the radio button,...
|
by: Gaurav |
last post by:
hello,
I have a form where i have a number of radio buttons.
How can i change space between the radio button and its text
example
o first radio button
o second radio button
|
by: jason |
last post by:
The following (likely far from imperfect code), reports a value of NaN
in the j4 display. I suppose the problem is I am not really passing
the "checked" value of the radio button via .value ... without having
to get this value via html, is there any way I can passed the checked
value via html .. maybe with syntax like n4.checked.value or
something..
Many thanks.
<html>
|
by: Oscar Monteiro |
last post by:
I Have to sets of Radio buttons like so:
<input type="radio" name=p1 value=1>
<input type="radio" name=p1 value=2>
<input type="radio" name=p1 value=3>
<br>
<input type="radio" name=p2 value=1>
<input type="radio" name=p2 value=2>
<input type="radio" name=p2 value=3>
then a text area and a button:
| |
by: xazos79 |
last post by:
Hi All,
I've come across the problem of not being able to re-enable a radio
button with javascript if its initial state has been disabled in the
Page_Load() method of the code behind.
Might i add that it behaves fine in Firefox, but IE is unable to
re-enable the radio button. IE is fine if the radio button starts in an
enabled state.
|
by: poojak |
last post by:
I have write two different js function in a external file. one function write a table (I used innerHTML for this.) and another function is for showing/ hideing some rows depending on radio button selection. Both of these function works properly when used in HTML file, but when I use same showhide function in a table which is created by Javascript that function doesn't work at all. I am copying both JS functions here also, If someone can solve...
|
by: runway27 |
last post by:
hi
i have registration form where user selects from a drop down to select their area code apart from filling other details in the form. in the next page which is a confirmation page i would like to display the select option that a user choose in the first page i am able to display this using a textfield however i would like to display using the select drop down.
following is the code for both select and radio button that i have used.
1....
|
by: runway27 |
last post by:
i am using a self submitting form
<form action="<?php echo $_SERVER; ?>" method="POST" id="test2" name="test1">
i need to do a validation of textfields, checkboxes, radio buttons
i am able to read, display and validate textfields after the form has been submitted however i am getting an error for
checkbox and radio buttons.
|
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...
|
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,...
| |
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...
|
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...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
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();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |