hello all, i have this html below
[HTML]<input type="text" name="items[1][quantity]" size="3" value="1" onchange="javas cript:showNameO bject();"/>
[/HTML]
and i want to alert that object of name with this script - <script language="javascript">
-
var form = document.forms[0];
-
function showNameObject() {
-
alert(form.items[1][quantity].name);
-
}
-
</script>
-
but the browser shown an error "document has no properties..."
any advice please...???tha nks
6 2047
I think name items[1][quantity] is not valid.
Why don't you explain what you are trying to achieve first.
Why don't you explain what you are trying to achieve first.
actually i have the function to create an element (input, textarea, and select option)..
and it's generated by looping..of course to make a name and id of that element that i've created is by array..This is the snipped of that function - function create_itemized_fields()
-
{
-
var form = document.forms[0];
-
// add a new counter to item_count, which tracks the current number of items.
-
item_count++;
-
if (item_count <= <?php echo DetailRowMax?>){//DetailRowMax value could be changed at config.php
-
var row = document.createElement('tr');
-
row.setAttribute('id', 'item'+item_count);
-
-
var td = document.createElement('td');
-
var p = document.createElement('p');
-
var label = document.createElement('label');
-
var span = document.createElement('span');
-
var theData = document.createTextNode('Pra BP No.');
-
var theInput = document.createElement('input');
-
theInput.setAttribute('type', 'text');
-
theInput.setAttribute('name', 'items['+item_count+'][quantity]');
-
theInput.setAttribute('size', '3');
-
theInput.setAttribute('class', 'requiredfield');
-
theInput.setAttribute('value',item_count);
-
//theInput.setAttribute('onkeyup', 'recalculate_items();');
-
span.appendChild(theData);
-
label.appendChild(span);
-
label.appendChild(theInput);
-
p.appendChild(label);
-
td.appendChild(p);
-
row.appendChild(td);
-
}else { alert("test");
-
}
-
}
-
-
so, have any idea?
acoder 16,027
Recognized Expert Moderator MVP
Please enclose your posted code in [code] tags (See How to Ask a Question).
This makes it easier for our Experts to read and understand it. Failing to do so creates extra work for the moderators, thus wasting resources, otherwise available to answer the members' questions.
Please use [code] tags in future.
Also, remember to provide a meaningful Title for any threads started (see the FAQ entry Use a Good Thread Title).
This helps to ensure that other members, and also the general public, will have a better chance of finding answers to any similar questions.
MODERATOR
acoder 16,027
Recognized Expert Moderator MVP
and i want to alert that object of name with this script - <script language="javascript">
-
var form = document.forms[0];
-
function showNameObject() {
-
alert(form.items[1][quantity].name);
-
}
-
</script>
-
but the browser shown an error "document has no properties..."
If this is the error, that means the error is on the line before the function: var form=document.f orms[0]. The document is not ready. Make sure the line is inside the function or called after the page has loaded.
PS. use the type attribute for the script tag. The language one has been deprecated.
PPS. and yeah, form.items[i][quantity] is incorrect syntax, but we can deal with that later.
If this is the error, that means the error is on the line before the function: var form=document.f orms[0]. The document is not ready. Make sure the line is inside the function or called after the page has loaded.
PS. use the type attribute for the script tag. The language one has been deprecated.
PPS. and yeah, form.items[i][quantity] is incorrect syntax, but we can deal with that later.
ok thanks a lot sir
kind regard, mamin
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Mark Hannon |
last post by:
I have been researching the "disabled" property for form data and
wanted to know:
- Does the disabled property supress the form item from being submitted?
- Can the disabled property be applied when the submit button is
pressed?
I am designing a PayPal order page that will have 4 items, each with a
3-character text box where the customer...
|
by: Alf P. Steinbach |
last post by:
Not yet perfect, but:
http://home.no.net/dubjai/win32cpptut/special/pointers/ch_01.pdf
http://home.no.net/dubjai/win32cpptut/special/pointers/ch_01_examples.zip
To access the table of contents, use the "Bookmarks" tab in Adobe
Acrobat.
Comments, corrections, praise, nits, etc., are still welcome!
|
by: VB Newbie |
last post by:
I am creating a user control containing a combobox using VB.NET(2003)
I want to add 2 public properties "DataSource" and "Items" like the
"System.Windows.Forms.ComboBox"
here is my code, but it doesn't work. What's wrong with it?
Public Property cboDataSource() As Object
Get
Return Me.cbo.DataSource 'cbo is my combobox
End Get
|
by: VB Newbie |
last post by:
I am creating a user control containing a combobox using VB.NET(2003)
I want to add 2 public properties "DataSource" and "Items" like the
"System.Windows.Forms.ComboBox"
here is my code, but it doesn't work. What's wrong with it?
Public Property cboDataSource() As Object
Get
Return Me.cbo.DataSource 'cbo is my combobox
End Get
|
by: Emily |
last post by:
Hi all,
I have the following simplified version of xml file:
<xml xmlns:s='uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882'>
<s:Schema id='RowsetSchema'>
<s:ElementType name='row'>
<s:AttributeType name='Fund1'>
<s:AttributeType name='Fund2'>
<s:AttributeType name='Fund3'>
| |
by: k386 |
last post by:
I am having trouble creating a hidden form field, or least having it accessible from getElementById.
Rough overview:
I am reading an XML file through XMLhttpRequest and outputting each item into a unique div tag, which has a dynamically generated name, then appending each div tag to an existing div tag. This is working A-OK.
Here's the...
|
by: luispunchy |
last post by:
I have an accordion style dropdown list/sublist menu (functions similar to the "today on WebMD video" widget found on http://www.webmd.com/) - it will allow users to click on a headline (from the main list) to open up the full listing (sublist) below that headline.
My JavaScript is almost but not quite working as needed. It also serves up an...
|
by: David C. Ullrich |
last post by:
Having a hard time phrasing this in the form
of a question...
The other day I saw a thread where someone asked
about overrideable properties and nobody offered
the advice that properties are Bad. So maybe we've
got over that. I suppose properties could have
Bad consequences if a user doesn't know they exist
and think that a certain...
|
by: kimiraikkonen |
last post by:
Hi,
I have a odd but a known question about listbox. I know listbox
control can provide multi-select, multi-extendend selections. But i
wonder if this selection type belongs to them or it has another
tecnique.
As you may know, in softwares like Windows Media Player or Winamp
playlist has a listbox and it can be selected in 2 types. First...
|
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...
|
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...
| |
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. ...
|
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...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
|
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...
|
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...
|
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...
| |
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |