javascript

Getting current URL in Flash from JavaScript using ExternalInterface and IE

Hi, I'm trying to get the current URL that the Flash player is on. Not the URL of the .swf file, but the URL that the browser is pointing to. Thus far I've used: var st:String = ExternalInterface.call("window.location.href"); Unfortunately this doesn't work in IE. From my research, I can see that it won't work with IE either way. The...

Streamline Javascript to calculate ranges

I have a bit of javascript that I am using to calculate the y-scale of a graph. I need to adjust the scale according to the value. This works but seems really verbose. Is there a more streamlined way to do this? if (maxValue <= 20000){ chartMaxY = 20000 } if (maxValue <= 10000){ chartMaxY = 10000 } if (maxValue <= 5000){ chartMax...

How to I call a javascript function on onrowcommand?

Using asp.net, c# 3.5, vs 2008. I have an aspx gridview called gv1 with a working c# codebehind onrowcommand method which is called when a button on the row is clicked. The button on the gridview is being dynamically generated. I am trying to replace that codebehind call with a javascript function to avoid a roundtrip to the server....

How to open file dialog in Flash 10 "without" user interaction

I want to open a file dialog via FileReference.browse() but I get #2176 error which means that this action can only be invoked upon some user interaction. I'm aware of security considerations but in my scenario I have a thin flash movie which merely displays an image and the whole UI is in javascript (I heavily use javascript <-> actions...

What MIME type should I use for jQuery Autocomplete queries?

The jQuery Autocomplete plugin relies on an odd response format. Specifically, it's a newline-separated list of pipe-delimited pairs, the first entry of each pair being some formatted text, the latter being a JSON object with some data. An example: Fuzzy Bunnies|{ id: '1234-fuzzy-bunnies', type: 'slippers' } Loud Hawaiian Shirt|{ id: '...

javascript: submit form in an iframe...help

I can't believe I've never done this before.... Here's my situation: I am using 2 jQuery plugins. Shadowbox and validate (bassistance). I click on a link to sign up for a newsletter. The link opens a form in a shadowbox. No biggie. The form is validated with the plugin. When the form is validated and ready to submit, it doesn't. ...

ajax calendar navigation with jquery

I have next and previous links in the html <a href="/event-sort/calendar/2009/9/sports/">prev</a> <a href="/event-sort/calendar/2009/11/sports/">next</a> When they are clicked, I want the page to make an ajax call to load a php script that will update the calendar's html now when the calendar updates, the arrows have been removed and...

Preloading/precaching images with JS isn't working the way I want it to; what am I doing wrong?

I'm trying to preload about 200 images using the following: var total_images = 0; var loaded_cnt = 0; var tempImg = new Object(); function precache_array(a,path){ for(var i = 0; i < a.length; i++){ tempImg[path + a[i]] = new Image(); tempImg[path + a[i]].src = path + a[i]; tempImg[path + a[i]].onLoad = image_loaded(a...

IE does not render changes while javascript script is running

I have a rather long running javascript code which adds a new "div" element to the document. It looks like in IE this change is being rendered only after the script is finished, which is not the case in FF. Any idea how to make it work ? This script is actually supposed to run forever, kind of "main loop". ...

jQuery how to select all tr elements from one row and up to a stop

A little odd situation. I'm writing a greasemonkey script on some legacy HTML where everything is put into one table. I want to select all TR elements from the one I click and the next 3-4-5-6 rows up to the next row that contains a TD.class_name table ... tr -> td.class_name tr tr tr tr -> td.class_name ... /table So, i...

CSS: How to fix an element horizontally but not vertically?

You can see an example here: http://alboard.free.fr/adrien/test.html The layout is based on horizontal scrolling (the red element). But I want the top part to be fixed (the blue element). If the user resizes the viewport, a vertical scrollbar will appear. If at this point the user scrolls down, the red element will go up while the blu...

Save the document generated by javascript.

Javascript can manipulate the document the browser is displaying, so the following: <script> document.write("<table><tr><td>Hola</td><td>Adios</td></tr></table>"); </script> Will make the browser display a table just like if it was the original HTML document: <table> <tr> <td>Hola</td> <td>Adios</td> </tr...

how do I set up sevenup?

Hi I am just trying to get this plugin to work but I am not sure what I am doing wrong. http://code.google.com/p/sevenup/ So I tried to follow the one like of code they give you. <script type="text/javascript" src="sevenup.0.3.min.js"></script> ... <body onload="sevenUp.test( options, callback );"> My test page. <html xmlns="http:...

How to manually trigger validation with jQuery validate?

I want to manually trigger validation including showing error messages with jQuery Validate. The scenario i am trying to accomplish is a form like this: <form> <input id=i1> <button id=b1> <input id=i2> <button id=b2> </form> When clicking b1, only i1 should be validated. hen clicking b2, only i2 should be validated. However all fi...

Javascript: Changing link color based on stylesheet function

I am a novice Javascript programmer; any help would be greatly appreciated. I have successfully implemented a script that allows users to switch from a "regular view" to a "high contrast view". The script is simply changing stylesheets. I have also set up the script with a basic toggle: when a user clicks "High Contrast View" the li...

Better method of retrieving values of checked input boxes via jQuery?

I have several checkboxes and a fake submit button to make an AJAX request: <form> <input type="checkbox" value="1"/> <input type="checkbox" value="2" checked="checked"/> <input type="checkbox" value="3"/> <input type="checkbox" value="4" checked="checked"/> <input type="button" onclick="return mmSubmit();"/> </form>...

IFrame content swapping bug?

I have a web page with a number of iframes, including 3rd party iframes like ad sense and various sharing buttons. In Firefox, I've noticed that occasionally the content of these iframes get swapped, such that you'll get an ad sense ad where another iframe is. It seems completely random where iframe content shows up. It seems it may ha...

Simplest/Cleanest way to implement singleton in JavaScript?

What is the simplest/cleanest way to implement singleton pattern in JavaScript? ...

Change the content type of a pop up window.

This question brought a new one: I have a html page and I need it to change the content type when the user press "save" button so the browser prompt to save the file to disk I've been doing this in the server side to offer "excel" versions of the page ( which is basically a html table ) <c:if test="${page.asExcelAction}"> <% ...

String "</script>" causes an error in IE

If I add this piece of html to my page: <script type="text/javascript"> var s = '</script>' </script> IE 7.0 shows a syntax error (exclamation mark in left bottom corner): "Unterminated string constant" if I change just one letter (any) the error disappears - looks like IE doesn't like this particular word, including brackets. Any ...