473,804 Members | 2,127 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

avoid innerHTML parsing

I need to create element with some content inside. This may be any
HTML stuff - tags, text. I do next

Set newelem = doc.createEleme nt("span")
newelem.innerHT ML = "<a href=""test\tes t.htm"">1st</a>"

(code above is written in VB, but it does not matter)

but in saved HTML I have anchor with absolute path
<a href="file:///c:/test/test.htm">1st</a>

All I want is avoiding internal parsing of innerHTML. I found, that I
can
set anchor.href directly and it will not be parsed. But I need to
parse string with element and find "href" substring. This seem to be a
buggy way.
I prefer to do it with no workarounds, with some simple and bugs-free
way.
Is there any chance for that?
Jul 20 '05 #1
1 6692


Sergey Batishchev wrote:
I need to create element with some content inside. This may be any
HTML stuff - tags, text. I do next

Set newelem = doc.createEleme nt("span")
newelem.innerHT ML = "<a href=""test\tes t.htm"">1st</a>"

(code above is written in VB, but it does not matter)

but in saved HTML I have anchor with absolute path
<a href="file:///c:/test/test.htm">1st</a>

All I want is avoiding internal parsing of innerHTML. I found, that I
can
set anchor.href directly and it will not be parsed. But I need to
parse string with element and find "href" substring. This seem to be a
buggy way.
I prefer to do it with no workarounds, with some simple and bugs-free
way.
Is there any chance for that?


Try
var link = document.create Element('a');
a.href = 'test/test.html';
span.appendChil d(a)
I don't see any reason to mix createElement with innerHTML assignment
--

Martin Honnen
http://JavaScript.FAQTs.com/

Jul 20 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
10911
by: Kyle | last post by:
I am presently making use of documentElement.innerHTML to retrieve page contents for manipulation, but I've noticed that the sting value returned is not identical to the actual page source. Specifically, attribute assignments that look like: height=100 width=100 in the real source, look like: height="100" width="100"
11
2513
by: kaeli | last post by:
Hey all, AFAIR, innerHTML started as MS proprietary, but Mozilla implemented it as well. Does anyone know if any other browsers support it? It is not in the W3C DOM, is it? A quick GIS seemed to answer 'no' to that, but you guys are better at finding these things than I am. ;) This page seems to think Opera 7, Safari, and IE Mac are cool with it too, and it seems to be faster. It also implies that innerHTML is NOT in the W3C DOM. Is...
3
2026
by: Ralph Snart | last post by:
i've read that innerHTML is not in the W3C standards and never will be. however i've found something that i simply can't do by manipulating text nodes directly. <div id="mydiv"></div> <script type="text/javascript"> document.getElementById('mydiv').innerHTML='ide&eacute; fixe'; </script> this prints "idee fixe" with the final 'e' of idee having an acute
6
6649
by: wk | last post by:
i have a <table></table> ...and the have a string with the html that will create the table rows, columsn etc....perhaps <tr><td>a row</td></tr>. this string comes dynamically from a source and can vary immensly. How can i use javascript to build the table from this string? I understand i cannot use innerHTML in a table :(
17
34745
by: PJ | last post by:
Greetings... I have stumbled upon a small problem. I use Ajax to retrieve part of a page I need to update. I update a DIV element with the HTML contents I get from another page. It works fine. However the HTML have a SCRIPT tag that the browser should process, but
8
3222
by: Pratik Patel | last post by:
Hello, I used innerHTML to assign HTML content. but in my HTML page content have also some javascript function and it will run when page load. bu when HTML code assgin thru innerHTML then this javascript is not working. e.g. html content:
11
1245
by: EnjoyNews | last post by:
Hi I just had a thought regarding spam... I have noticed that when I do something in JavaAjax then I can't se the context in the source. .... If I open a page in a div with Ajax, right click and choose Source, then the div is empty. The context in the ajax page is not there. Off cause you can find the .js file and see what page it opens.
6
4259
by: PaPa | last post by:
I'm not sure this is a javascript issue or an HTML issue. I notice that when I extract the contents of a div using the innerHTML property (?), that I wind up with a literal variable (?) which exactly matches the contents of the div with one exception. It seems that whenever the code includes a tag which uses the forward slash against the closing bracket (say the break tag ..... />) that the browser, or HTML, or javascript, or...
0
1409
by: samz | last post by:
Hello, Here is a simple PHP recursive file list (with interactive and visual FX) Sam's Files http://acc.jexiste.ch/JPN/RecurciveDIR12.RAR 1. How to ignore/avoid empty folders in this PHP script ? 2. How to sort files by filename (and, if possible, folders on top) ? 3. Is this MAILTO hidden tool still useful against the current Spam robots ? Mysterious Ways - Hide Email Addresses from Spam Harvesters 4. Is my SpamPoison tag useful if I...
0
9712
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9594
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10595
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10343
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10089
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9171
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6862
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
2
3831
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3001
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.