There are two main things which I am trying to work through:
Drop down menu (bottom of page) - which only works in IE (on pc) right
now, although it should work on all browsers except opera.
Traditionally in a HTML 4.0 Transitional environment.
Div content that scrolls - placed correctly and works in IE and that's
it. Here is an example of the working script on another site
http://www.dyn-web.com/dhtml/scroll/scroll-rel.html . Traditionally in
a Xhml strict.
My goal is to get this page to look as good in Netscape and on the mac
as it already does in IE.
I'm considering in teaching myself some javascript, but before I take the time to read up and experiment, I had a few questions.
Is javascript XHTML 1.0 STRICT Valid? Is javascript valid for any version of XHTML? Is javascript easily cross browser compatiable, or will this take a long time to work around?
I am using a simple javascript image insertion on my XHTML page, and I have encountered a problem. The Javascript code fails to execute when the doctype is XHTML on Firefox (works on Opera). However, when I simply rename the file with an HTML extension, the code executes on all browsers. Code:
I'm just restating my "site abandonment" post but with a clearer title as I realized it probably only made sense to me and me alone.
I have window that pops up with our commerce system. I have it set to pop up a window via JavaScript if the visitor quits early in the process (abandons the commerce system before completing all of the steps. The new popup is just a customer survey ("why are you leaving, is there something else we can help you with" etc. etc.).
Here's the problem, it works fine in IE, but in Firefox, anytime the page in the original commerce window is changed, refreshed or advanced to a new page, the survey popup window is called rather than just on window close.
Again, here's the two JavaScript routines that handle clicks on the graphical close button and on the window 'X' close button. Code:
I have the following javascript function, which works fine in Firefox but does not work in IE. I have a feeling it has something to do with window.status. Any ideas??
<!-- START JAVASCRIPT --> <script type=text/javascript> function tracker() { window.focus(); if (window.status) { click = new Image(); click.src = 'http://myurl.com/tracker.php?pid=12345&type=click' } }; view = new Image(); view.src = 'http://myurl.com/tracker.php?pid=12345&type=view' //--> </script>
Usually it's the other way (IE works, Firefox not working)... but here it is. IE does render something, although it puts the advert script (starting on line 9) at the very end, after the close of the last table. Firefox displays it as I have intended it (Ad inside the table). Code:
I have some code, using all the DOM documentation in the developer.mozilla.org website. For some reason it's only working in the newest Firefox 2 versions, and not 1.5.0.x
I'm having a hard time finding any documentation of what's not supported.
Can you guys help me? Here are the functions I'm calling:
getRangeAt();
range.collapsed
document.createElement("div");
range.cloneContents();
element.appendChild(clone);
document.getElementById("divid");
do you think it's createElement div? Maybe I can't create a div element?
I've spent the last two hours trying every other solution listed, to no avail: this works, so I'm sharing it for the other folks who couldn't find a solution other than switching to another language.
var fileString = "mydevfolderfolder2folder3file.txt";
var myPat = /%5C/g; //this is using regular expression to define the escaped version of a backslash
I have a page with two frames, 'header' and 'main'. The following code works in Netscape, but in Internet Explorer. The second bgColor line produces an error:
function test(){ top.frames.header.document.bgColor='white' //works fine top.frames.main.document.bgColor='white' //fails }
I am trying to include and xml document inside my xhtml document. There are a number of reasons for this including portability, multiple interface generation, and scalability of information. My problem is that javascript is understanding the nodes in my xml document as html elements.
<xml> <book> <title>Lord of the Rings</title> </book> </xml>
If I parse this, the title element cannot be extracted and the page title(in the browser) becomes "Lord of the Rings". Is there a way to exclude this xml node from the xhtml rules?
Maybe you can answer a question for me: I'm reading the preview for XML web development (sitepoint book) and it clearly shows IE rendering XML (the author states IE5 and above); does that mean that IE's problem with XHTML is CDATA and not XML universally? If that's true then IE could render an albeit gimped XHTML page which would explain why HTML 4.01 and XHTML are virtually synonymous in IE 6.
Is there a workaround for this in JavaScript, if the above is true?
I'm facing the bug about the failure of innterHTML while reading xhtml content inside a DIV, in fact it has passed as html removing the closing of some nodes. Is there a way to read the content of the div perfectly how it is in the page, kind of:
var obj = document.getElementById("myDIV"); var realContent = obj.toString();
IE6 in standards mode doesn't seem to hide scrollbars on the body element (overflow:hide) Ain't this a quandary. I have it in my head that I need to specify html instead. The scrollbars do hide on Gecko browsers though, so there is definitely a disagreement among browser developers on how to implement scrollbars (as a side note, Gecko browsers with their notoriously bug-ridden resize code seem to always screw up when asked to stretch and scroll divs, even when the page is reloaded on every resize!)
My first thought is to modify the CGI that generates the style sheet as I already have code that deprecates the document type when hidden scroll bars are required on IE6 (but not IE5.) This is based on the simple empirical evidence that the scroll bars are still there on IE6 in standards mode, so the optimal document type (XHTML strict) cannot be used. So I could just change this to output an html style (rather than a body style) for IE6 and lose the deprecation (it wouldn't be needed at this point.)
So the question is this. Given that CGI-based processing of browser versions for these kinds of tweaks is taboo, what would you check on the client side before dynamically generating the style for the body and/or html element? It doesn't seem like you could just send both as this would surely break some older browsers (I know you can do tricks with comments and such, but that only works for NS4 and maybe IE3 AFAIK.)
documentElement is the only thing I can think of that indicates standards mode and NS6/Mozilla support this AFAIK.
IE Conditional comments perhaps? I would hate to hard-code a test for a browser version number into the actual document (for obvious reasons), but I guess it is an alternative if the browser version is exposed to these things.
I don't see any other way to deal with a situation like this than with server-side code that looks at the browser's version number and makes the necessary adjustment. And there are lots of little differences like this that just don't seem to have viable client-only solutions. There's DirectX stuff (probably is an object detect for that) and funky colored scrollbars (hey people ask for them) and document margins (Opera did them slightly differently than the rest as I recall) and now this scrollbar thing.
When using innerHTML to insert xhtml IE5+ mangles the xhtml completely. For example it removes the quotes from attributes. It also does other ridiculous things like on a <div> it will insert the enbedded style="DISPLAY:BLOCK"! This is a documented feature you can find in msdn.
Is there a way to disable this quite appalling feature?
I am trying to find a way to load XHTML content in an Iframe.
I use to do this in html by using the following code :
var iframeObject = document.createElement("iframe"); MyDiv.appendChild(iframeObject); var data = "<html><head><title>testing</title></head><body>data</body></html>" iframeObject.contentDocument.open(); iframeObject.contentDocument.writeln(data); iframeObject.contentDocument.close();
This works fine. I can create my content dynamicly and synchroniously. No problem.
No I try to switch to XHTML, but have trouble getting th eiframe to understand that it gets XHTML data. It simply assumes that the data is "text/html". I tried to add the contentType with the .open() arguments:
var iframeObject = document.createElement("iframe"); MyDiv.appendChild(iframeObject); var data = "<!DOCTYPE html PUBLIC "-//W3C//DTD ..etc.. transitional.dtd">" + "<html xmlns="http://www.w3.org/1999/xhtml" > etc etc </html>"; iframeObject.contentDocument.open("application/xhtml+xml", true); iframeObject.contentDocument.writeln(data); iframeObject.contentDocument.close();
The code runs but the content is not seen as xhtml, so I can't mix html and xml. Someone gave me the hint to use the following:
I try the following in Firefox and other modern browsers:
window.addEventListener('load', function() { document.title = CSS.getClass('fontSize'); var div = document.createElement('div'); document.getElementsByTagName('body')[0].appendChild(div); alert(div); alert(div.style) }, true);
It works fine in normal HTML mode (Content-type: text/html), but in XHTML mode it alerts "[object Element]" instead of "[object HTMLDivElement]" and the second alert shows "undefined" instead of "[object CSSStyleDeclaration]". So I can't reach the style declaration which is important for me. Strict mode makes trouble again and again, the biggest bug: document.write does not work:
I've just been converting my ASP v2.0 web site to use master pages which by default uses this doctype:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
whereas before it used to use:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
This appears to have effected the multi-line textarea tag in that it doesn't completely obey the height attribute. It appears to adjust the height to the nearest line height.
Opera 7 doesn't appear to support the <script> element in XHTML. Does this mean that it impossible to use Javascript with XHTML? Or is there a workaround, such as the legacy method, in HTML, of commenting out the Javascript code.
this turns out to be a non-trivial exercise. inserting '<' and '>' causes the browser to write the text to the page as literal text rather than as the intended script element. Using escape codes seemed to work (makes it standard compliant) but the text is not written to the page.
The point is to have a conditional branch in which, when a certain condition is true, a script tag will be generated that will call a JS include that responds to the specific condition.
This procedure works in the present implementation -- but fails XHTML compliance testing. Now, we would like to have both.