473,385 Members | 1,901 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,385 software developers and data experts.

turning a string to the dom object it represents

15
I have a string which represents a dom object.
How do I turn it into an object like document,
which I can traverse and use methods like
getElementByTagName()?

Thanks alot,
Yuval
Mar 1 '08 #1
4 1165
acoder
16,027 Expert Mod 8TB
window["document"].someMethod().
Mar 1 '08 #2
yovalk
15
What do you mean?
I have a string which is html code, how do I turn it into a document?
Thanks,
Yuval
Mar 1 '08 #3
See with javascript a keyed array is equivilant to an object property
i.e
Expand|Select|Wrap|Line Numbers
  1.   array["name"] === array.name
So when traversing the dom you can for example input a string

"document"

which you could use as

i.e
Expand|Select|Wrap|Line Numbers
  1. window["document"].firstChild 
same as

Expand|Select|Wrap|Line Numbers
  1. window.document.firstChild
Mar 2 '08 #4
acoder
16,027 Expert Mod 8TB
Yes, that's correct. Objects are also associative arrays in JavaScript.

If you still can't get it to work, post your code or an example string.
Mar 2 '08 #5

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

Similar topics

9
by: Steven T. Hatton | last post by:
This is from the draft of the previous version of the Standard: http://www.kuzbass.ru:8086/docs/isocpp/expr.html 2- A literal is a primary expression. Its type depends on its form...
4
by: Chumley Walrus | last post by:
This may be easier than I think, but I need to find a quick way to change a datetime object to string, as the following mydateobject = mydateobject.ToString(); renders the error: Cannot...
9
by: rsine | last post by:
I have developed a program that sends a command through the serial port to our business system and then reads from the buffer looking for a number. Everything worked great on my WinXP system, but...
3
by: Rich | last post by:
Hello, I am converting an app from VB6 to VB.Net and have encountered the following problem. I have the following loop which retrieves objects from a collection of objects. Dim entry As...
5
by: Terry Olsen | last post by:
Looking for info on how to convert a byte array to a string, and string to byte array. Thanks.
3
by: barry | last post by:
I have the following: function(NAMED) { sString.Append("document.forms.NAMED.style.visibility = 'hidden'") } and would like to convert the NAMED into the object it represents - for example in...
1
by: andy_w_irvine | last post by:
Hi, Apologies if this has been asked elsewhere, I did search but expect I didn't hit on the required terminology. I want to be able to use a string variable called objectName (original!) to...
232
by: robert maas, see http://tinyurl.com/uh3t | last post by:
I'm working on examples of programming in several languages, all (except PHP) running under CGI so that I can show both the source files and the actually running of the examples online. The first...
3
by: DannyB13 | last post by:
Hi, and thanks for possible help in advance. Here's my dilemma. I've been making a sudoku generator, and I'm now stuck on one part. I must be able to take a 'solution' and verify that it is correct,...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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...

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.