473,407 Members | 2,629 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,407 software developers and data experts.

syntax question to catch dynamically generated divs in a page

i've got a -maybe dumb- question since i've never had a single js lesson :)

i want to catch some divs in a page, at first i got all the names of them from a db, but now they are dynamicly generated.
so.. i couldnt use php anymore.. so.. this is what i came up with:


Expand|Select|Wrap|Line Numbers
  1.  if (obj.name.match('resize'))
  2.     {
  3.     instance = str.replace(/resize/,"");
  4.  
  5.     elements.q+instance+.resizeTo(dd.obj.x-elements.q+instance+.x+12, ((obj.y+12)-dd.elements.q+instance+.y));
  6.         elements.opt+instance+.moveTo(dd.obj.x-24, dd.obj.y);
  7.         elements.movemove+instance+.moveTo(dd.obj.x-12, dd.obj.y);
  8.         }
well, this doesnt work.
example:
object name is "resize1"
i strip resize
and i want to get:
elements.movemove1.moveTo(dd.obj.x-12, dd.obj.y);

you know what i mean :)
Nov 11 '06 #1
1 1185
acoder
16,027 Expert Mod 8TB
Assuming these are the IDs, use document.getElementById:
Expand|Select|Wrap|Line Numbers
  1. document.getElementById("q"+instance)...
May 28 '08 #2

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

Similar topics

699
by: mike420 | last post by:
I think everyone who used Python will agree that its syntax is the best thing going for it. It is very readable and easy for everyone to learn. But, Python does not a have very good macro...
14
by: Akbar | last post by:
Hey there, Big-time curiosity issue here... Here's the test code (it's not that long)... it's to display a large number of image links with captions, ideally pulled in from an external file...
27
by: Nicholas Couch | last post by:
I have a little form with a couple of dynamically generated list boxes. When the user makes a selection from the first box, the second box is refreshed. When they make a selection from the second...
0
by: Mark Phanides | last post by:
My ASP.NET application intermittantly (but always at same point) redirects to the 'Invalid Syntax Error' web page for some unknown reason. I've created a ASP.NET application written in VB.NET with...
3
by: Dan | last post by:
Is it possible to dynamically create and populate properties? Below is my class. I would like to define properties for each of the items in my two arrays without actually defining each one. (There...
2
by: James Black | last post by:
I am dynamically generating a table in IE to display some information. I will probably change it to divs later, but I just want to get it working properly first. In my div I have the following...
0
by: dave.dolan | last post by:
Ok, I'm using an XSL to generate the content div of a page. I'm using http://script.aculo.us to do some asynch posting and getting so that I don't actually have to have the server know what I've...
3
by: jonnyblazed | last post by:
Okay..... I'm gonna sum up what I want to do cause it will make it pretty simple for you guys to understand. Here we go: I have a form that posts data to a PHP mailer page I have created. When...
1
by: maya | last post by:
I'm using a function like this to load divs dynamically (and hide current one..) function get_img(curr_img,curr_nav,new_img,new_nav2) { var img_top = eval('document.getElementById(' +...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...
0
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...
0
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...
0
tracyyun
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...
0
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,...

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.