redho home | products | services

Programming Forums


Community for Java, PHP, Perl C, ASP and Python programmers
Wednesday 12 December 2018 22:06

Ask your IT question here

how to place the text


Goto page 1, 2  Next
 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Programming Forums -> JavaScript forum
View previous topic :: View next topic  
Author Message
Peter Pitt
Enthusiastic Coder


Joined: 20 May 2006
Posts: 114
Location: Egypt
Can anyone tell me how do i place text within a "A" element created with document.createElement??
Reply with quote
 
optomeb
Enthusiastic Coder


Joined: 19 May 2006
Posts: 113
create a text node, then append it to the element.
Reply with quote
 
Peter Pitt
Enthusiastic Coder


Joined: 20 May 2006
Posts: 114
Location: Egypt
any examples??
Reply with quote
 
optomeb
Enthusiastic Coder


Joined: 19 May 2006
Posts: 113
http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/ecma-script-language-binding.html has the API description
Reply with quote
 
Peter Pitt
Enthusiastic Coder


Joined: 20 May 2006
Posts: 114
Location: Egypt
will this do:body=document.body;var link=document.createElement("a");link.setAttribute("href", "bla bla");var text = document.createTextNode("bla bla");body.appendChild(link);link.appendChild(text);
by the way is there a way to print the title of a page inside an iframe??
like frame_name.title

Reply with quote
 
optomeb
Enthusiastic Coder


Joined: 19 May 2006
Posts: 113
Don't know. I haven't worked with iframes for ... well, certainly I haven't this century. Far too troublesome.
Reply with quote
 
Peter Pitt
Enthusiastic Coder


Joined: 20 May 2006
Posts: 114
Location: Egypt
do TextNodes support html??
like <br />

Reply with quote
 
ovigo22
Enthusiastic Coder


Joined: 15 May 2006
Posts: 130
Pure text
It will output that as text

Reply with quote
 
Peter Pitt
Enthusiastic Coder


Joined: 20 May 2006
Posts: 114
Location: Egypt
ovigo22_, how do I place a break between two text nodes??
Reply with quote
 
ovigo22
Enthusiastic Coder


Joined: 15 May 2006
Posts: 130
CreateElement('br'); append a text node, append an HTML element node (of a br), append another text node. And it'll be 2 text nodes
Reply with quote
 
Page 1 of 2 Goto page 1, 2  Next
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Programming Forums -> JavaScript forum


Dubai Forums - Expat Help | Vegan Forum | Java Programming | 3d Design Resources | 3d Forum | 3D Jobs | 3D Textures | Paris Forum | Europe Forum
Dubai Classifieds | Dubai Property | Jobs in Dubai | Free London Classifieds | Jobs in London UK

High Quality, Custom 3d animation and Web Design solutions Royal Quality Web Hosting Services Vegetarian and Animal Rights news

© 2018 RedHo