I am trying to complete a javascript application and am having problems with code similar to that show below.
Much testing has shown that Firefox finishes the code shown in around 0.25 secs but Internet Explorer 6 takes a massive 3.5 secs! Internet Explorer 7 gets it down to around 2 seconds - but that's still 8 times slower than Firefox and way unacceptable for my userbase.
Looking through the newsgroups there is some discussion around the differences between the way the two browsers handle arrays - but a performance differential such as this is just unbelievably dismal.
Unfortunately I need to continue to use arrays of objects and have to support the Internet Explorer client base. I have already added specification of the array size and also removed the use of array "push"ing - flattening the array is not really an option. Code:
I have the script below, which is supposed to populate a text box on a form which opened this popup window - it should then call a function 'PostThisPage' on the opener document, and then close the current window/popup.
This works ok in IE - can anyone please help me by pointing out what it needs to become cross-browser compatible? It doesn't work in Firefox 1.0.
All this time I was testing my sites only in IE6 until my friend told me it wasn't working in FireFox. So I have to make changes in my Javascript code. In the Javascript console all the errors are pointed at the window object in all lines. alert(event.type) gives event undefined. Then I tried Event.type because I read somewhere that mozilla reads it as Event while IE as event. But then it gives:
Error: document.Event has no properties Source File: http://localhost/xxx/xxx/xxx.js Line: 3
Any idea of what I should be doing for it to work in FireFox ? The site works perfectly fine in IE until someone told me that IE doesn't follow w3c rules.
I am using a custom JS dropdown in place of an HTML select ... the problem is the drop is used to select a link then a button is clicked to goto the selected item.
In IE it work perfect ... but in FF the values just get appended to the URL in address bar ... it is just a window.open function but will not work. Code:
I use the following script in order to show/hide a section, and at the same time to change a companion .gif with another:
function doExpand(paraNum,arrowNum){ if (paraNum.style.display=="none"){paraNum.style.display="";arrowNum.src="../../images/arrOn.gif"} else {paraNum.style.display="none";arrowNum.src="../../images/arrOff.gif"} }
and then in the body: <div id="reltpc"><a href="javascript:;" onClick="doExpand(xplan1,ico1)"><img id="ico1" src="../../images/arrOff.gif" alt="" width="10" height="9" border="0"> Show Info</a></div> <div id="xplan" style="display:none" onClick="doExpand(xplan,ico1)"> <p>text here</p> <p>some more text here</p> </div>
Furthermore, two more scripts are used in order to show/hide a section without the image:
function doSection (secNum){ if (secNum.style.display=="none"){secNum.style.display="block"} else{secNum.style.display="none"} }
function noSection (secNum){ if (secNum.style.display=="block"){secNum.style.display="none"} }
and then in the body: <div id="more"><a href="javascript:;" onClick="doSection(dtails1)">More Info</a></div> <div id="dtails1" style="display:none" onClick="noSection(dtails1)"> <p>text here</p> <p>some more text here</p> </div>
All three of them are working good in IE and Ffox, however the second claims to use "gelElementById" instead.
Well, how could it be done? Would you help me please, to get that conversion?
I have a php page with a drop down list, and the default selected option is "Select a location" (without quotes). Using the drop down initiates a database query. One of (3) things should happen:
1. If an option is selected for which results are available, they should be displayed on the same page beneath the drop down list in a table.
2. If an option is selected for which results are NOT available, a message should be displayed informing the visitor that there were no results for that query.
3. If the default selected option has not yet been changed (ie: when the page first loads), no message should display.
#1 and #2 work, but the message described in #2 is still displayed when the page first loads before the default selected option is changed (#3) but in Internet Explorer only. Firefox displays the page correctly under all three conditions.
The message that I want hidden on page load is wrapped in a div named "infobox" and I'm using the following script to hide it which is at the bottom of the page:
<script language="javascript" type="text/javascript"> function ClearDiv() { if (document.form2.name.options[document.form2.name.selectedIndex].value=="Select a location") { document.getElementById("infobox").style.display = "none"; } }
ClearDiv(); </script>
I've also included the php code that writes out the message and the table below....
I have a script that uses eval() and it works great under IE but it craps out when eval() is called in firefox. Just ignore all the commented out alerts, it is for testing purposes. Code:
I have a section of Javascript code that works a treat in IE but does nothing in Firefox. If we remove the doctype it appears to work, put the doctype back in and it breaks. We need the doctype to remain in so the page renders correctly cross-browser. Code:
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:
Is it possible in javascript to operate on an array without knowing how mamy elements it has? What i want to do is sending an array to a script, and this script should add all values from that array Could you show me a little example how to do this?
I have a problem with a Javascript, which doesn't works in Firefox You can have a mouse over the 2 first pictures, but after the second picture has moved over the screen, nothing is happening when you move the mouse over the slideshow The source 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?
What I get in IE is the "YO!" written to the iframe. What I get in Firefox is the 404 not found page of the site where the original "jstest.html" page and script are hosted.
I have a page with words within TH tags. When you put your mouse over the entire table, it is supposed to change an image source location to the one in the onmouseover as well as a block of text. I keep getting undefined errors though. I've been unsuccessful googling for the past hour for the proper syntax for accessing the span and image properties in mozilla. I tried adding document in front of each monument, mainimg, and maintxt without any luck. It has worked fine in IE6.....
I have this: Code: <a href="javascript:employeeSearch();" class="textbutton">Lookup</a> and it doesn't seem to be working with firefox? does this look right? in IE it works fine.
I've been using the very cool Transmenu javascript drop down menu that I heard about on this forum. Below the menu is a flash movie that I set to 'transparent' so that the menu will display on top of the movie. This works GREAT on internet explorer, however I've recently become a big fan of firefox and the menu still seems to fall behind the flash movie in that browser.
Has anyone had experience with this issue? I could really use a solution here to get the menu to display on top of the flash.
i have made an application in php so that people can make, on the fly, a form. when they submit the form there is a javascript formvalidation.
because we do not know how many fields there are in the form (it is made on the fly) i collect all the form fieldnames in an php array and sent it to the javascript function: Code:
I have a DataTable that I created in C# that looks like.
Column1 - Column2 - Column3 1 - a - b 2 - c - d 3 - e - f
Now if I want to get the value of column 3 with id 3 I simply need to do something like this (pseudo-code):
string value = dt.rows[3]["Column3"].ToString();
Is there a javascript object that mimics this same functionality? I am going to use my C# DataTable to create a javascript object that I can use for client-side functionality before posting back to the server.
Is it possible to have a JavaScript object that works just like a standard Array, except that when the array is modified, a function gets called which can then do some processing on the array?
Like this: // SpecialArray has a function called Notify function Notify() { // process the array with changes made } var myarray = new SpecialArray("zero", "one", "two", "three"); myarray[1] = "ein"; // after this change is made, function "Notify" is called
I know you can derive a new object from Array, but you cannot directly override the [] operator.
Can you add a function or event handler to a regular Array object that gets called when the array changes?