javascript

Browser-Compatibility Testing with Visual Studio and ASP.NET apps.

I'm currently testing browser compatibility with IE7 for an app that I built initially for use with Firefox. The assumption at the time within our organization was that we could get everyone to use Firefox, but that's been called into question, so here I am. As a result, I have used many Firefox specific features and attributes that I ne...

can JSON serialize an array that uses *functions* as keys?

I'm dabbling with a linguistics Javascript project. I'd like to build it using objects to represent Nouns and functions to store Verbs as this makes conceptualizing my project less difficult. I'm using functions as keys to an object (I've written an example below). Will it be possible to serialize this with JSON when it comes time to sav...

How to convert large UTF-8 strings into ASCII?

I need to convert large UTF-8 strings into ASCII. It should be reversible, and ideally a quick/lightweight algorithm. How can I do this? I need the source code (using loops) or the JavaScript code. (should not be dependent on any platform/framework/library) Edit: I understand that the ASCII representation will not look correct and wou...

Custom dropdown box using javascript and css

hi everyone, Is it possible to create a custom dropdown box using javascriit and css. for which i need to place a background-image for dropdown box using javascript If yes or no ? if yes . give any suggestion ? without using JQuery Thanks & Regards Ravi ...

Why is jQuery deleting my <img> element?

I'm using jQuery with the BlockUI plugin to block a page after a link is clicked. I'm also using a DOM element to display a message when the page is blocked. Here's a simple example of the code used: <a id="testme" href="#">Click Me</a> <script type="text/javascript"> $(document).ready(function() { $('#testme').click(function...

How to provide (in IE and Firefox) a binary file download in a popup that closes ?

I need a cross-browser solution to the following use case: The user clicks an "export" button on one of our pages, which opens a popup with a form. On submitting the form, the user should receive a binary file download (a CSV file, for example), and the popup should close without changing the visible content of the parent window. We...

Isn't AJAX on pageload a bad thing?

I've seen this on nerd dinner and other sites. On page load (in JavaScript, via the browser), an AJAX request will go out to get some data from the same server that rendered the initial page. The data will be small and there are no technical limitations that would have otherwise prevented them from just pulling down that data in the fir...

Why does getDay return incorrect values? (javascript)

I tried to get the day of a week with the getDay() function of the Date object in Javascript. In theory it works fine, but sometimes there is a delay in the output, so if the function should return a "4", it returns a "1". E.g. var date= new Date("2009","04","30"); alert(date.getDay()); // the function returns 6, should return 4 var ...

how do I set a .click jquery variable for use on page reload?

During the course of a page I am choosing a picture frame to frame an image with matting - that part works. What I want to do: Say The matting is set at 1 mat and the frame is set for Frame8 if I decide I want 2 mats how will I be able load frame8 when the page reloads. Right now it reverts back to the default frame. Jquery and php ar...

What's going wrong with window.open here?

I'm encoding the parameters in a url and setting the href of an a tag as follows: href="javascript:var win=window.open('LayerPreview.aspx?tLNUMCswKSXpnGpQy1rWev26c5euEUa97eqiZYdDpMvDcKNbi6Z05Q3WC5DhG%2b8HJFGHAo%2fHiSFrtEEsHiConkpaT2aJ2WV0Hxxqo2l1bmkNdAotVVvI%2fT4JtE%2fc3dJ8MEAhM3NJZ15qk3fkW87q9A%3d%3d','','width=800,height=600,resizable...

What is the best javascript barcode generator?

I need to generate a I25 barcode using javascript only. Looking for a good, reliable, cross-browser javascript component. ...

How did the guys at DeviantArt implemented the Shadowing in their images?

Hi guys, I just want to know how the guys at DeviantArt.com implemented the shadowing on each images. If you look at the thumbnails, you'll see that the images are shadowed a bit. I think they done it with Javascript because when I turned off my Javascript the shadows were gone. And they are also using jQuery btw. ...

Is there a way to call [ScriptableMember] in Asp.Net via jQuery.

I know there's a way to call [WebMethod] via jQuery ($.ajax(...)) I was wondering if it's possible to call [ScriptableMember] via jQuery. ...

Show/hide fields depening on select value

Hello, I am trying to show and hide a few form fields dependent on the value of one of my select fields, I am looking to use arrays to to hold what should be show and what should not be show for each select value, to save me from a massive switch statement, but cannot figure out to do it. I am using PHP and jQuery. Any help would be g...

In XUL, how do I know a browser-tag has finished loading?

I'm developing a firefox extension based on this tutorial which is a FF 2.0 extension (second part of the tutorial is at this url) The main thing that is important is that it uses <iframe id="contentview" src="http://www.ibm.com/developerworks/web" flex="2"/> In the backend code, when clicking the GO button, this happens: contentvie...

I want to trigger an event every single time data changes in an HTML text input field regardless of focus

How do you catch the client-side event when a browser changes an input text field using the browser's autocomplete feature for a plain HTML input field? (This is the small dropdown on input fields that is supplied by the browser, I know that you can disable it with "autocomplete=off" in some browsers per input field.) I'm already bindi...

Grabbing data from JSON using Javascript

Ok so I have a json output that looks like this: {"Result" : [ { "Id" : "5214", "ParentReasonId" : "0", "Description" : "Billing & Payment", "SysName" : "Billing & Payment", "SysCategory" : "Billing & Payment", "ClientId" : "924...

how to truncate HTML encoded text without truncating encoded characters using javascript

I need to write some client-side javascript for a webpage that will truncate the text inside a div, when the onclick event for a button is fired (the purpose of the button is so that users can toggle the displayed text between complete and truncated versions). There won't be any HTML tags in the text, but there may be HTML encoded charac...

Marquee Text When Text Overflows

Hi all, well heres my problem. Lets say i have 3 div tags, all are 100pixels wide: <--- DIV WIDTH ---> Text in div 1 Text in div two, it overflows Text in div three <--- DIV WIDTH ---> Now, currently i have this css for the divs: width:100px; overflow:hidden; What i want to do is if the text overflows, it scrolls like a marquee so ...

Reading UTF8 chars using innerHTML returns 0xfffd for all chars

I'm reading an HTML document that contains UTF-8 chars but when I access the innerHTML of the document, all the "bad" chars show up as 0xfffd. I've tried it in all the major browsers and it behaves the same way. When I alert() the innerHTML it shows those chars as a "diamond with a ? mark". Surprisingly the following works perfectly, co...