javascript

Speed and style of Math.max vs ternary operator in JavaScript

In JavaScript, is it better to do this: var h = th > ch ? th : ch; or var h = Math.max(th, ch); ? ...

appendChild in IE6/IE7 does not work with existing elements

I have a div that needs to be moved from one place to another in the DOM. So at the moment I am doing it like so: flex.utils.get('oPopup_About').appendChild(flex.utils.get('oUpdater_About')); But, IE, being, well, IE, it doesn't work. It works all other browsers, just not in IE. I need to do it this way as the element (div) 'oUpdater...

umbraco tiny MCE 3 internet explorer insert link error

Hi, I have an instalation of Umbraco 4.0.2.1. In internet explorer (6 / 7) i get an error when trying to insert a link using the tiny MCE rich text editor. basicaly what happens is i can choose the node in the site i want to link to but when i click insert it reloads but the tiny MCE popup does not dissapear and i get the following pa...

modifyContentString returns [object Window] instead of "real" content

Hello everybody, I try to manipulate the sifr output. I want to add some kind of bullet in front of it (»). I found the method "modifyContentString" at the sifr 3 wiki. But I cannot get the contents. All I receive is an [object Window]. What went wrong? sIFR.replace(myFont, { selector: '#sidebar li', modifyContentString: functi...

Is it possible to load gzip compressed javascript without a webserver?

I have been trying, unsuccessfully, to get a HTML page to load an external GZIP compressed javascript file from the local filesystem using a HTML file such as this: <html> <head> <script src="test.js.gz" type="text/javascript"></script> </head> <body></body> </html> When I open this HTML file directly in a browser, the Javascript file...

Why < is getting converted as &lt; during runtime

I am trying to write an aspx page where I am passing some server side value to the Javascript. The server side tag is changing from <% to &lt;% <asp:TextBox ID="txtOriginalNo" runat="server" onkeyup="javascript:EnterKeyPress(<%=ibtnSubmit.ClientID%>,event);" TabIndex="1" MaxLength="13" ></asp:TextBox> This is getti...

jQuery Plugin for HTML Editor with Syntax Coloring

I'm looking for a jQuery Plugin that will display a textarea for HTML authoring & editing. The things I'm looking for: Must support authoring the HTML, not a WYSIWYG representation Must color the HTML as you type as any rich-client IDE would. Should be jQuery, but native JS would be OK too. I have played with MarkItUp which gets...

Javascript set img src

I am probably missing something simple but it's quite annoying when everything you read doesn't work. I have images which may be duplicated many times over the course of a dynamically generated page. So the obvious thing to do is to preload it and use that one variable as the source all the time. var searchPic; function LoadImages() { ...

Making Javascript-search-function fast

Hello everyone, I made a little search-function with javascript to look for a string in a table: There are "tr"s that simply contain a number as an id and there are "tr"s that contain "childNode+idOfParentNode" as an id (e.g.: <tr id="1"> ... </tr> <tr id="childNode1"> ... </tr> Now I want to look through the table, see if a giving s...

Javascript Regex help for beginner

Hi, I need to validate the below range via regex in javascript. -20.00 to +20.00 with an increment of 0.5. The user should be able to enter the 1.50 as well instead of +01.50. I tried to do a lot of research in google, though regex is not easy. If I understand it correctly, then I will need to split up the regex into smaller grou...

get full url history using javascript

There is window.history object in javascript. It's possible to get lenght of the history using window.history.lenght or redirect to the previous / next url in the history using history.go(N) Is there any trick to get URL of the history objects? As i see it's not possible with history object, because urls are even not readonly. Do you...

jquery plugin to edit table cells in place and save to file (also select diff kinds of inputs)

I am generating a html table from a mysql query (generates a new flat html page) Is there a plugin that i can use that will let me click/edit individual cells and save that data and refresh the content (important, cause i scrape the page and write to file later) but i also need to be able to select individual input types, some are simpl...

Using tabs on a webpage

Hi all, I am using zapatec tabs on my website. There are some javascript function which I want triggered when tab is loading. How do I go about it since the window.onload is not working. There is one main page on which the tabs are added and that is why the page is already loaded by the time the tabs are being loaded. Thanks in advance, ...

address validation in java script

Hi Iam new to j query can any one let me know if there is a way to declare a jQuery.validator.addMethod function and write the java script inside this jquery validator for validating address where it should not take "PO BOX", "PO BIN", "BIN", "P.O BOX", "P.O BIN", "P.O", "PO" the above values can be in any case spaces before, in bet...

How to obtain the HTML DOM element of a Google Maps marker?

Hey everyone, Given a GMarker JS variable, how do I obtain the HTML DOM element that represents it? I need this so I can insert a <div> of my own into the map with the correct z-index. Thanks. ...

javascript validation for address

Hi Iam new to j query can any one let me know if there is a way to declare a jQuery.validator.addMethod function and write the java script inside this jquery validator for validating address where it should not take "PO BOX", "PO BIN", "BIN", "P.O BOX", "P.O BIN", "P.O", "PO" the above values can be in any case spaces before, in betwe...

jQuery 1.2.6 caching

Hi, I'm doing quite a bit of DOM manipulation in my app, adding new nodes, and I've found that the children() function can get out of sync. I've got a tbody element with two rows, I use the children() function on this to do some manipulation with these rows. I then add two more rows to the tbody, when I use the children function again t...

Google Maps - controls disappear in Firefox but not Internet Explorer 6

I've got a Google Maps JavaScript bug which I can't get to the bottom of. The code works as in you see the maps on the page, but the controls seem to be "under" the map images, you only see them on page load, and when you zoom in or out quickly. Sorry for just dumping code here, but I honestly can't see where the issue is. I've tried: ...

Why is Jquery slower in IE?

I have a complex ASP.NET page that makes heavy usage of jquery for DOM manipulation (no AJAX). The page is faster in Mozilla based browsers (Firefox) compared to IE 7 or 8. Are there some functions that are optimized for FF? ...

Javascript sending key codes to a <textarea> element

Hi, I can't figure out how to trigger a keydown event on a textarea element, e.g. imagine i have two textarea elements and when i type something in the first one, I want the second box to show the typing as well, but for a certain reason I have to do it via events. This is what I tried and it doesn't work: <script language="javascript"...