An alternative is to enclose the entire string in a CDATA block, so that the XML parser that receives your AJAX reply will not parse this stuff, but treat it as plain text. I have had to do this when delivering javascript and HTML to be stuffed into a string on the client side rather than being...
Another scheme that I use quite a bit is called CSS switching.
In your CSS (either within <style></style> or in a separate file), put
.hid {display: none}
Then when you want to make the element invisible, do this
MyTypeIn.className = "hid"
To make it reappear,
MyTypeIn.className = ""...
... and just for extra credit, you may find that you get tired of typing all that cruft pretty soon. Here is a little routine that goes into nearly all my pages, just so I don't have to type "document.getElementById() and get all the camel-case stuff right:
function idGet(str) {
return...
When I first started using XML as the medium for replies to AJAX queries, I thought I had a real can of worms, too. But a close look at the DOM produced when Firefox parses your XML for you will reveal that every time the XML contains a line-break, the DOM gets a text node (nodeType=3). Unless...
The second thing to check is whether your function getField() is returning a string or a number. The date() constructor will accept either one, but does different things depending on which type its argument is.
As I noted above, if you wait for the onload event to fire in the target window, the URL there will reflect the final source of the HTML. You will need some JavaScript in this onload event handler to pass that info back to your "main" window.
Oh, BTW, event handlers are noticeably different...
In your case, with 2 frames, you ought to be able to get at the properties of each frame considered as a window by using the construct top.frames[1].document.URL.
This depends on the "redirector" frame being 2nd in your HTML, but should give the right result. You might need some JavaScript...
Rather than setting the style.visibility property on each of your table cells, I would recommend that you consider a technique called "CSS switching". Initially, you declare things to be hidden as "class='hid'", where the CSS contains a line like this:
.hid {display:none}
Then when you want...
As dwarfthrower noted, you cannot write JavaScript exclusively within your content frame that will give you the status of the main frame.
The way to approach this (assuming you have a way to include JavaScript in the top-level window) is to write some code that is included in the common parent...
I worked some more on this tonight, and must sheepishly report that my previous post is in error: if I stop Firebug at a breakpoint, apparently that also halts any javascript activity toward loading scripts, and that seems to be what was producing the results I reported yesterday.
I improved my...
Yes, I thought about that problem, too. The exact sequence is:
1. XML arrives
2. If it contains a JavaScript library tag, extract the filepath, construct the script element, and start that download.
3. Stuff HTML (containing references to this JavaScript) into target DIV (using...
Well, I finally got time free to do the experiment you suggested, and I have mixed results to report: creating the script element, assigning a URL to the .src property and attaching the element to the document head DOES cause Firefox to download the indicated script file, and DOES make the...
I have built several projects now using AJAX to load page fragments instead of whole pages, and am pretty pleased with how this all works. I have come to the point where I wanted to avoid having to load all the JavaScript files for all possible parts of the application upon a first visit by a...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.