javascript

Good open source JavaScript math library for floating point operations?

Can any one recommend a good JavaScript library to solve floating point problems in JavaScript? ...

How do I pre-cache images for quick viewing with javascript?

I have a webpage where I want the user to see a new image when they put thier mouse over a certain part of the image. I used an image map. <img src="pic.jpg" usemap="#picmap" /> <map id="picmap" name="picmap"><area shape="rect" coords ="10,20,30,40" onMouseOver="mouse_on_write('mouse is on spot')" onMouseOut="mouse_off('mouse is off sp...

Java <-> Javascript for non-Applets?

I'm working with an existing Java codebase which, while it can be invoked from an HTML page using an <APPLET> tag, does not actually subclass the Applet class. The same jars are also used in a non-browser context, so they did not subclass Applet. Now I need to communicate some values from Java back to the Javascript of the invoking page...

Testing objects for ancestor/descendent relationship in JavaScript or Jquery

I'm trying to come up with a reusable JS or jQuery function that would allow me to test if one object is a DOM descendant of another. I've seen a model of testing for $b.parents('nodename').length>0 Which is fantastic when you only need to check if an element is a child of any node by that name. But what about a specific node? You...

Enums in JavaScript?

What is the preferred syntax for defining enums in JavaScript? Something like: my.namespace.ColorEnum = { RED : 0, GREEN : 1, BLUE : 2 } // later on if(currentColor == my.namespace.ColorEnum.RED) { // whatever } Or is there a more preferable idiom? ...

How do I look over a javascript array without using indexes in YUI?

I know that jQuery and prototype have a $.each() function for iterating over each element in an array. Does YUI offer any help with this? ...

YUI in IE6 & IE7

I'm using Bugzilla 3.2 RC2 (released 11/06/2008) There is some conditional logic deep in there that shows a 2nd dropdown when the 1st has a value of "Resolved". Works great in IE8, Firefox, and Chrome. It doesn't work at all in IE6 or IE7. No Javascript error and nothing happens. I'm wondering if anybody else has run into this iss...

JavaScript RegEx for div tags

I have a JavaScript variable which holds an HTML page and due to the setup I need to extract everything between <div id="LiveArea"> and </div> from that variable using JavaScript. Any help is greatly appreciated. ...

How do I log cross-domain intranet traffic (including username) using a HTTPHandler?

I am attempting to log user activity for a couple internal websites as well as our SharePoint sites. I use JavaScript to make a call (GET) to an ashx page (HTTPHandler) that returns a 1x1 invisible GIF. The HTTPHandler grabs the referring URL, browser info, ip address, the action (sent as a QueryString), and (the part I'm strugging with)...

JavaScript non-regex Replace

Do any of the existing JavaScript frameworks have a non-regex replace() function? or has this already been posted on the web somewhere as a one-off function? For example I want to replace @!#$123=% and I don't want to worry about which characters to escape. Most languages seem to have both methods of doing "replaces". I would like to se...

Get the position of a div/span tag

Can someone show me how to get the .top & .left position of a div or span tag when one is not specified? ie: <span id='11a' style='top:55px;' onmouseover="GetPos(this);">stuff</span> <span id='12a' onmouseover="GetPos(this);">stuff</span> In the above, if i do: document.getElementById('11a').style.top The the value of 55px is ret...

Prints pdf when page loads

Hi, I have this code in my aspx page; <a href="javascript:void(0);" onclick=<% Print(); %> title="Print listings">Print</a> which presents a link to print a listings to a pdf when the user clicks on it; as you can note the script calls a function from the behind code. The problem is that when I coded this it happens that when I go th...

How to code a JavaScript modal popup (to replace Ajax)?

I need to replace our Ajax Modal Popup controls with a JavaScript equivalent. We use this as a simple context sensitive help type popup. I did a quick browse but didn't see quite what I was looking for. I just need some text and a simple Close button/link, but I would like the page darkened below the popup, as it does with the Ajax modal...

Is there a Request.IsMvcAjaxRequest() equivalent for jQuery?

I prefer to use jQuery with my ASP.NET MVC apps than the Microsoft Ajax library. I have been adding a parameter called "mode" to my actions, which I set in my ajax calls. If it is provided, I return a JsonViewResult. If it isn't supplied, I assume it was a standard Http post and I return a ViewResult. I'd like to be able to use somethin...

Javascript regex to match a person's height

Hi, I need a javascript regex pattern to match a person's height to check if the input is valid. Here are some sample input: 5' 9" 6' 5'8" Any ideas? ...

Ajax "Is there new content? If so, update page" - How to do this without breaking the server?

It's a simple case of a javascript that continuously asks "are there yet?" Like a four year old on a car drive.. But, much like parents, if you do this too often or, with too many kids at once, the server will buckle under pressure.. How do you solve the issue of having a webpage that looks for new content in the order of every 5 second...

Turn off caching for JavaScript files on Firefox

During development I have to "clear cache" in Firefox all the time in order to make it use the latest version of JavaScript files. Is there some kind of setting (about:config) to turn off caching completely for JavaScript files? Or, if not, for all files? ...

textbox autocomplete

how do i make an autocomplete textbox in asp? but i need to get the autocomplete data by querying the database. I dont really know how to explain this, sory if theres not enough detail. i cant use ajax, because i think i will have compability issues with my old app. so im thinking of doing this using java script. or is there a way to d...

How to find checked RadioButton inside Repeater Item?

I have a Repeater control on ASPX-page defined like this: <asp:Repeater ID="answerVariantRepeater" runat="server" onitemdatabound="answerVariantRepeater_ItemDataBound"> <ItemTemplate> <asp:RadioButton ID="answerVariantRadioButton" runat="server" GroupName="answerVariants" Text='<%# DataBinder.Eva...

Browser dependency problem in image display

Hi All In my page, I am displaying a report after the user selects some information. On a button onclick event, I am displaying an image which rotates itself to indicate to the user that the request is being processed. The image rotates in the Firefox but not in IE(it just displays the image). Please give me your suggestions. with re...