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

img element

Hi,

In my application developing using VB .Net, i want a create HTML elements dynamically. I want to create as given below ,

Expand|Select|Wrap|Line Numbers
  1. <div class="contact">
  2. <dl class="user">
  3. <dt>
  4. <img class="onicon" title="Online" alt="Online" src="var/images/spacer.gif"/>
  5. </dt>
  6. <dt class="photo">
  7. <img class="usimg" title="Photo" alt="Photo" src="var/images/user.gif"/>
  8. </dt>
  9. <dd>aaa</dd>
  10. <dd class="statusmsg">Available</dd>
  11. </dl>
  12. </div>
For the above, i have written code like this,

Expand|Select|Wrap|Line Numbers
  1.     Public WithEvents htDoc As HtmlDocument
  2.     Public WithEvents div As HtmlElement
  3.     Public WithEvents dd1 As HtmlElement
  4.     Public WithEvents dd2 As HtmlElement
  5.  
  6.             htDoc = WebBrowser1.Document
  7.             div = htmlDoc.CreateElement("DIV")
  8.             dd1 = htmlDoc.CreateElement("DD")
  9.             dd2 = htmlDoc.CreateElement("DD")
  10.            dd2.InnerHtml = "----------------------------------"
  11.             dd1.InnerHtml = "TTTTTTTTT"
  12.             div.AppendChild(dd1)
  13.             div.AppendChild(dd2)
  14.  
  15.             htDoc.Body.AppendChild(div)
The above code works fine. Now how do i append a img element. Also how do i mention the class ?
Any help will be highly appreciated.

Thanks,
Dev.
Feb 10 '09 #1
2 1325
Curtis Rutland
3,256 Expert 2GB
To add an IMG tag, just do the same thing with IMG instead of DIV or whatever.

To set attributes such as CLASS, use SetAttribute.
Feb 10 '09 #2
Hi,

Thanks a lot !
That worked .

Dev.
Feb 11 '09 #3

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

Similar topics

1
by: Igor | last post by:
Is there any way to resort and xml document using xslt based on element position. For example if I have xml like this: <root> <element> 1st thing </element> <element> 2nd thing </element>...
4
by: Gordon Dickens | last post by:
I have target xml to generate from schema. All of the XML instances have the same global element i.e. <base>. I would like to combine all of the schemas into a single schema where I could...
6
by: Wole Ogunremi | last post by:
I guess this is a well asked question but it is tripping me up! I'm putting a forum together allowing xhtml markup content. I am validating against a schema but getting "Could not find schema...
5
by: Patient Guy | last post by:
In my reading of the Strict and Transitional DTD for HTML 4.0, the table row (TR) elements are contained within table section elements: THEAD, TFOOT, and TBODY. The table section elements are...
6
by: Luke Dalessandro | last post by:
I'm not sure if this is the correct forum for platform specific (Mozilla/Firefox) javascript problems, so just shout and point me to the correct newsgroup if I'm being bad. Here's the deal... ...
1
by: jrmsmo | last post by:
Hi there, I have an interesting problem that maybe you pros can suggest how I solve. I'm working with a third party program that serializes an XML document (it was obviously not designed with schema...
4
by: patrizio.trinchini | last post by:
Hi all, I'm new to XSLT and maybe my problem have a very trivial answer, but I need an expert that point me in the right direction. What I would obtain is to remove all the elements that have a...
3
by: jparulan | last post by:
Hi All, I'm using SOAP3.0. I was able to successfully call a WSDL file and get a value properly. But when the WSDL changed to have a MULTIPLE <element name> it was failing. This code works...
8
by: VK | last post by:
Can be multiple instances of element used as the root element? That's a curly way of asking, but I did not come up with a better sentence, sorry. What I mean is with a document like: <?xml...
2
by: mlb5000 | last post by:
I seem to be having issues validating an XML document using my schema. Both are below: The Schema: <?xml version="1.0" encoding="UTF-8"?> <xs:schema...
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: 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
Oralloy
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,...
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.