473,324 Members | 2,214 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

getElementById containing/similar to

30
Hi,

I'm new to javascript. I need to be able to set a variable what get the value by an ID that contains a particular let and not exactly. Can one use a wild card?
Here is what I'm trying to do:

Expand|Select|Wrap|Line Numbers
  1. var start_t_mon = document.getElementById("*_partofid").value,
So I want to set this variable for any form field value that contains "_partofid"!
Sep 15 '07 #1
3 4907
pbmods
5,821 Expert 4TB
Heya, CPT.

You'll like these better:
[CODE=javascript]
JavaScript code goes here.
[/CODE]
Sep 15 '07 #2
cptuser
30
Heya, CPT.

You'll like these better:
Expand|Select|Wrap|Line Numbers
  1. JavaScript code goes here.
  2.  
Thanks for the tip. Are you able to assist with my query?
Sep 15 '07 #3
pbmods
5,821 Expert 4TB
Heya, CPT.

document.getElementById() does not support globbing, but you might find it useful to use the name property combined with document.getElementsByName():

Expand|Select|Wrap|Line Numbers
  1. <div id="1_partofid" name="partofid">...</div>
  2. <div id="2_partofid" name="partofid">...</div>
  3.  
Expand|Select|Wrap|Line Numbers
  1. var divs = document.getElementsByName('partofid');
  2.  
Sep 15 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

10
by: JJA | last post by:
I'm trying to use document.getElementByID inside a function where the ID is passed as an argument. I get the same error ("Element has no properties") on the same statement inside the commonCheck...
24
by: Robi | last post by:
I have the following problem: I populate a page with a specific amount of <div id="MyTest"> containers inside another <div> container. for (i=0; i < MyString.length; i++) document.write('<div...
3
by: weston | last post by:
Maybe I just need another pair of eyes or two, but it really seems as if document.getElementById is choking on me. This page: http://www.mortgageplans.com/mbc-network/enroll.html?EC=245 has an...
12
by: bcr07548 | last post by:
I am writing a web site that uses JavaScript to validate certain forms and I seem to be having some trouble. The site uses PHP and for one of the forms, depending on the situation, one of of the...
3
by: edai | last post by:
I am working on a code where I am loading XML data from a file on the server using ....... if (xmlhttp.readyState==4) { value=xmlhttp.responseText; var parser=new DOMParser();...
1
by: mhito | last post by:
hi guys, My first post yes. Thanks for all the nice posts and threads in this forum - great stuff. Now, here's my question: First off, the url : http://catfish.businesscatalyst.com/bcimg.htm...
29
by: Nick | last post by:
I've seen a few frameworks use the following: function $(id) { return document.getElementById(id); } Then to use: $('something').innerHTML = 'blah'; I'm just trying to roll this out to my...
7
by: SM | last post by:
Hello, i need to add a classname to an element <ausing JavaScript. I've tried a couple of thing with no success. This is an small piece of my code: .... <li><a href="<?php echo $cd_img; ?>"...
2
by: =?iso-8859-1?q?KLEIN_St=E9phane?= | last post by:
Hi, I've a xml svg file and I would like to update it with Python. First, I would like to fetch one dom node with getElementByID. I've one issue about this method. This is my example : ...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.