However, I was wondering - I realize there does not seem to be a "standard" way to do this (without additional libraries), but is there any "hacky" method that can be used to get XPath support in IE? What I mean is for parsing the loaded HTML document.
Just wondering - is there some trick that allows this to be done of which I am not aware? Specifically, I would like to use XPath to query the _current_ HTML document in IE.
I was wondering if you could cast some light on a confusing subject. is there a way which you know of that can search through html documents and extract selected information, and display that in another (main) html document?
MSIE 6.0 apparently does not support protyping with objects created with document.createElement, while Firefox does.
I tested it by typing it into the adress bar, but it also appears to be the case for code embedded in a HTML document. Here's a simple segment of code to demonstrate the difference:
javascript: function myObj(){};myObj.prototype = document.createElement('a'); var x = document.createElement('a'); var y=new myObj(); var z= new Object(); alert(x.href) /*blank in both FF & MSIE6 */; alert(y.href) /* blank in FF but 'undefined' in MSIE6 */; alert(z.href) /* 'undefined' in both FF & MSIE6 */;
I wonder why that is (apart from the fact that MSIE implements JScript and not javascript), and can anyone tell me which of both browsers is complient with W3C standards?
I just wanted to know if I have a text document that contains html code,how would I search through the code and retrieve all the data related to the search. i.e. by creating a search engine. The problem I face is if the format of the tag names change in the html txt document then it won't work. Therfore using DOM to retrieve the text would fail. Is there anything other than DOM that I can use to parse through the text document, so even if the code changed the search engine would still work.The aim is to search through a html "text document" and retrieve the data that the user wants.
I have a textarea and I would like to prevent users from inserting HTML tags. Only plain text is supported. Which client-side js regular expression is best for this?
How to get outerhtml for document.body for different browsers.
I am passing document.body to the method mentioned in the code below:
Code:
function getOuterHTML(object) { try{ var element;
[Code]....
In firefox and chrome, I get only the HTML markup; but the data that is part of the controls of the input object is not getting populated.Whereas, in IE it works.
Suppose a HTML document has a iframe. Using javascript,I want to detect ,on load of the html document, whether the body of the iframe document is ready to be displayed.I want to be able to overwrite the the body contents (before it actullay loads) of the iframe.can I do it with jquery? say if ,HTML doc is
Is there a way to redirect your site to another site if the browser doesn't support HTML 5? So, if you where using an old version of IE or Firefox that didn't support HTML 5 it would redirect them to another page.
Normally an SVG document is loaded/parsed/interpreted inside an HTML document using an 'object' (or 'embed') element, although there are supposedly other ways too. The problem is, the SVG document must be static this way.
I want to use the DOM interface to build SVG dynamically inside an HTML document. I am guessing I can build it inside HTML within an 'object' (or maybe 'iframe'?) element.
My intentions/goals:
In Javascript, I construct an object 'embedSVG' which has properties and methods for creating valid SVG elements and setting their attributes and attribute values.
During construction, the SVG document is created with its root element. During debugging in FF 2.0 (I'll work on an MSIE-compatible format later), I am using the Mozilla DOM Inspector and comparing nodes when the 'object' element is loading a valid external SVG document, and when I am appending the child representing the SVG document created by the DOM functions.
However the child node (#document) does not specify 'svg' as the root element, but instead 'HTML'. Something is not working.
Here is the relevant code in 'ScriptTest.html' which is the HTML in which the SVG is supposed to be embedded. Below it is the relevant code for 'svglib.js' which is supposed to contain code for building the SVG dynamically.
What this code is supposed to do is load the HTML page and execute the anonymous script, and draw a navy blue-bordered yellow rectangle on a blank page. This is similar to the example in the SVG 1.1 W3C Recommendation on page 202 of the 719-page PDF.
I am getting an exception when embedSVG object placeInHTML() method is called: NS_ERROR_DOM_HIERARCHY_REQUEST_ERR. I find in DOM Inspector in spite of or after the exception that a document is placed as a child of the object element, but it is HTML, with a default 'head', 'title', 'body' elements placed.
It is possible to perform a find in page search that looks at a specific link, opens the page in a new window and finds the text within that document? Basically I regularly use an html page in work that has a list of people and their telephone numbers.I want to be able to type in a searchbox on my main page and it open the target page and find the name I am looking for?Is this possible or can you only Find In Page on the same page or another frame?
How to consume web service in javascript...The output of the webservice is another XML file. I am new to XPath. how to use XPath to get the data out from the web service output, and show it in a simple table with 3 columns...
I have a bunch of divs with the same classname, 'mediafield':
And I have this jquery code in my header:
So I know that the click function is getting implemented.. The alert box appears however I get the following error in firebug: uncaught exception: Syntax error, unrecognized expression:[@class=mediafield] Line 0
Nothing happens when firebug is turned off... So I'm not sure why it's throwing the error.
I'm using a simple dom parser function to catch xpath information of all nodes of a document. Say html is like : HTML Code: <div> <div>Everyday People</div> <div>My name is ACE</div> <div>Hello world</div> </div>
And parsing the DOM to store the xpath infor in array 'arr' Code: <script type="text/javascript" src="js/jquery/js/jquery-1.3.2.min.js"></script> <script type="text/javascript" src="js/jquery/js/xpath-selector.js"></script> <script type="text/javascript"> function get_XPath(elt) {var path = ''; for (; elt && elt.nodeType==1; elt=elt.parentNode) {var idx=$(elt.parentNode).children(elt.tagName).index(elt)+1; idx>1 ? (idx='['+idx+']') : (idx=''); path='/'+elt.tagName.toLowerCase()+idx+path; }return path; }var arr = Array(); htmlDoc=document; x=htmlDoc.documentElement.childNodes; for (i=0;i<x.length;i++){ arr.push(get_XPath(x[i])); } </script> And later on in the script using the values stored in 'arr' to perform some functions like showing,hiding or changing content of nodes.
Code: <script> for(i=0;i<arr.length;i++){ //catch the object reference with the xpath info $(arr[i]) } </script>
But in the snippet above,I'm getting a object but unable to I'm unable to get the object reference..and use it for something like $(arr[i]).text(); Any work on Jquery Xpath selectors?
Suppose I have an html document with javascript, opened in my web browser. I need my script to generate another html (which just displays some text), and open it in new tab automatically. How is it done? Conside this code:
cTD = new Array(); // Collection des TD ligne par ligne for (i = 0; i < cTR.length; i++){ cTD[i] = cTR[i].getElementsByTagName('td'); alert("une cellule"); }
but if eTBL is correct...... cTR.length = 0
why this $%*#@ of value is 0???? my array have 8 lines with 7 cell for each, but the first line have only 3 cell
Using my IE v.6 browser, document.write doesn't convert HTML entities (e.g. ', &) to the appropriate character (though NS 6.2 works fine).
Obviously I can get round this for particular entities by writing some code to do the conversion before using document.write - but I need a more general solution that will catch any of the HTML entities.
A trawl with Google has found a number of people raising the question, but no answers. Any suggestions?
Is there no plug in that can convert html+css to a PDF document. I develop in PHP and I am having a huge headache trying to get this to work. The PHP PDF libraries that I have tested are not good with HTML, the conversion always fails.
There is already a question like mine but the i think my scripts are different :S I too want to "use 2 different jquery plugins on the same page for a website I'm making. At the moment I can only seem to get one working at a time, but not both. The plugins I'm using are Coda-Slider and FancyBox. I want to use FancyBox within the content of Coda-Slider." i Also do not know much of javascript..
I need to save an HTML page to Word using JavaScript. I have found some script on-line but all of them use the "Save As" procedure which only allows to save in txt and html format. I need it to be in Word.