Recently, I have learned about the document object model, along with vital facts about JavaScript Functions, regular expressions, and prototypes.
My learning has culminated in the creation of a powerful client-side HTML generation library. Now, my HTML() bookmarklet library packs 154 functions into less than 2K! Once these window, String and Array functions are loaded, large HTML constructs can be created with very compact JavaScript "clientlets."
I welcome your comments about this technique for client-side HTML generation. It's highly cross-browser.
Recently, I have learned about the document object model, along with vital facts about JavaScript Functions, regular expressions, and prototypes.
My learning has culminated in the creation of a powerful client-side HTML generation library. Now, my HTML() bookmarklet library (url...) packs 154 functions into less than 2K! Once these window, String and Array functions are loaded, large HTML constructs can be created with very compact JavaScript "clientlets."
Is there any way to resize an iframe dynamically to the height of its content that works cross browser and works when the iframe content is on another domain than the main page (I have access to both pages, so code can be put in either) Also, it must resize when links in the iframe are clicked (ie when a new page within the iframe is loaded)
After 1.5 years of writting my website I installed NS. It's JS works alot different to IE's, so it looks like I've got to write most of my site again!! [img]images/smilies/frown.gif[/img]
NS will only read 1 external JS file, which is abit of a nuisance as my site has a JS file common to site, another for the subfolders of the site, and the page's JS included with the HTML.
I'm trying to put all of common functions into one JS, but some of the functions have large amounts of text assigned to them. I'm trying to import the text using XML sheets as needed, but having a bit of a problem with the line Code: xmlDoc.childNodes[i].childNodes[2] where NS will only read 1 array of childNodes. How do extract xml with NS's JS?
If my audience uses not so old browsers, do I have to use cross browser DOM? If they have IE 5 or later and Netscape 6 or Mozilla 1.0 or later and any version of Opera that is not older than 6 months?
In some pages of my website I use a code like the following:
for (var n = 0; n < getTagsArray("SPAN").length; n++){
//SPAN is just an example. I also use other tags tag = getTagsArray("SPAN")[n];
//make something with tag... }
function getTagsArray(Tag){
if(document.all){ //Internet Explorer return document.all.tags(Tag); } else if (document.layers){ //Netscape eval("return document.tags." + Tag); }}
I want to put all browser-specific code inside the getTagsArray function. So far, I've programmed only for Internet Explorer (my browser), but now I want to make my website visible to all browsers. I'm not sure about the getTagsArray function. Is it right or is there a better way to do the same thing? And how can I extend that function to make it work in other browsers?
Finally, where can I find some information about cross-browser programming? I have the javascript reference for Internet Explorer and Netscape, but I know nothing about other browsers.
a lot of the code I have trouble with is events-based, although there are some DOM-navigation problems that I've noticed in IE.
before I launch into a probably fruitless attempt to write an API that corrects IE's DOM-mangling, I'm wondering if someone else may have already invented that particular wheel.
ideally, this would be a script which I simply link to in the head, and then write valid DOM code which automagically works.
This is a snippet of code from my HTML, and it has been giving me a lot of trouble. It works in IE6 and FireFox, but not in Opera and I can't test other browsers.
What I'm looking to do is make this as cross-browser friendly as possible, which I'm guessing might be able to be done by the way of javascript functions.
The only problem is I don't know any javascript, this is all I know and a quick solution is all I'm looking for.
So maybe, firstly it would be best to ask if it is even possible to achieve this show/hide effect on all browsers, and if not, what options I have?
would like to know which is the best WYSIWYG editor you are using for every of your application? I do not actually have any since i'm not in need but I may consider adding one to one of my upcoming project.
I am building a webpage that loads information from an XML file. I am using XMLHTTPrequests.
On page load a function populateH(); is called which reads the XML file and populates the HTML(Home) page accordingly. The function uses getData() functions to read and write from the XML file.
The page works properly in FireFox, but the populateH() function doesn't seem to work with other browsers. I have tested my getData() functions in other browsers and it seems to work fine.
(example available at: [url]
My get data function is written as follows:
Code:
And my populateH() function is written as follows:
Code:
I use the XMLHttpRequestObject in the populateH() function to set the nodes to retrieve, and the getData() functions are called in the place functions (placeNews(), placeFriends(), placeLinks()) to write to the HTML document.
I have a website[URL]... that has a car search box functionality which uses an external javascript file to populate the makes and models within the dropdown boxes.
A few weeks ago I realised that it didn't work in safari (initilly I had the populate onload code attached to the submit image), I then moved the code into a inline script tag and it worked but now i've realised it doesn't work in Firefox... I am now thinking of adding a script to determine the browser and dynamically work on adding the populate code depending on the browser but thought it would be a good idea to post on here in case there is an overall much better solution. If you visit the site you will see a working example of the issue.
I'm trying to find a javascript/DOM navigation tree to use in a web-based content management system, to allow navigation of > 10,000 folders/files.
The javascript (non-DOM) tree we currently use is running too slowly as it cannot dynamically load in nodes when users select a node to expand. This is critical for us. The top level of the tree hirarchy only has 20 or so nodes, but each node might contain up to 1,000 nodes.
So what we need is for the tree to process and display the first tier (20 nodes) and then only process sub-nodes if the expand icon is clicked.
Does anyone know whether such a tree exists?
It needs to be compatible with all modern browsers (IE 5+, Netscape 6+, Opera 7+, Konqueror 2+, Safari etc). I've looked at several different examples, but none of them (AFAIK) appear to be fully compatible with the above list of browsers.
I am brand-new to javascript, but after reading some tutorials online I was able to make a dynamic HTML photo gallery in javascript. It works fine in all browsers except IE6 (big surprise). I've been looking around online for solutions, but the fixes I have seen don't seem to work. I assume I am misunderstanding something... I was using element.setAttribute but have changed my code to avoid that. Here is an example. IE6 displays the link text but doesn't do anything else--exact same result I had by using element.setAttribute('name', 'value').
I wanted to know if we have some validator tool available which can validate our jsp code for W3C standards and for cross browser compatibility for browsers like IE, Mozilla, Chrome.
I have a document with a parent element that has mousedown,mouseup and mousemove events registered to it. The parent element has some child elements as well. I observe inconsistent behaviours between browser types when I hold the mouse button down, move the pointer and release the button.
ie7 - mouseup fires when over a child or parent
op9 - mouseup fires only when over the parent
ff2 - mouseup fires only over a child or parent but only if the pointer has moved since the mousedown occured
I have been trying to programme the script below so that it will work in Netscape Browser 7.1, 4.73 and Microsoft Internet Explorer; but without success. When I attempt to execute the function flyingsleigh() I receive a JavaScript error: Invalid argument at line:19 Char:7 The idea of this script is to make a graphic run across the browser screen - left to right when the form button is pressed, executing the function using onClick event handler. Code:
've been looking to implement a function which allows me to populate 2 form fields from an onClick event. I needed to be able to fill/modify one field on a single click and the other on a shift-click. This is all working fine but only for IE 5.2/Safari/Opera 8.02 but fails in Camino(Gecko). I don't have much experience in working across the different DOMs, I do know that I will need to use a different variation of the shiftkey (e.shiftkey?) and for NS4 (e.modifiers?); but I really am not certain as how to handle these correctly. Initial testing has been with limited success.
Could anyone give me some practical pointers to handle the 'shiftkey' for Gecko/Netscape4? (Gecko is more critical)
Current code as below:
function fillform(txt) { if (event.shiftKey) {event.returnValue = false; alert('shift on'); MM_changeProp('fieldone','','value',txt,'INPUT/TEXT')} else {alert('click only'); MM_changeProp('fieldtwo','','value',txt,'INPUT/TEXT')} }
window.attachEvent doesn't work in Netscape 7.2 or other browsers, is there an alternative that can be used? I did some searching on the web but all I could find was how to use window.attachEvent, not what else could be substituted for it to work with other browsers (if anything)
Soliciting thoughts on the best way to determine the position of a click event.
Here's what I'm using right now but it's not working:
Code: function getMousePosition(evt) { var x, y;
if(evt.pageX) { x = evt.pageX; y = evt.pageY; } else if (evt.clientX) { x = evt.clientX + document.body.scrollLeft - document.body.clientLeft; y = evt.clientY + document.body.scrollTop - document.body.clientTop; }
if(document.body.parentElement && document.body.parentElement.clientLeft) { var b = document.body.parentElement; x += b.scrollLeft - b.clientLeft; y += b.scrollTop - b.clientTop; }
alert(x + ',' + y);
return [x,y]; } The coordinates are WAY off in both firefox and IE. Can someone fix this?