javascript

YUI autocomplete misalignment problem

I am using the autocomplete YUI feature. However, as you can see I am having trouble aligning the suggestion drop down with the text input when I put a label in front of the text input. I am following the example here exactly except for this snippet of code where I simply replace the H3 with a label element in the form: <div id="myAu...

searchbox : autosuggestion with XML

Hi.. I want to make a searchbox which has auto suggestion and searches specific tag in a XML file. How can i realze this ? ...

Why does my event handler cause an "is not a function" error, but works from the Firebug console?

Using JQuery 1.2.6, testing from Firefox 3 and IE7. I have a very basic bit of JavaScript to reload a captcha image. In my JS file, I have: var Captcha = { count: 0, Refresh: function(){ // Concatenate "count" to force a URL change, which forces the browser to reload the image $('#Captcha').attr('src', 'Captch...

Do you have any security concerns when it comes to JQuery plugins?

Hello all, I am curious as to what, if any, security concerns other develpers have in regards to the use of JQuery plugins. I have seen very little talk about security where JQuery is concerned. Is it really a non issue? Appreciate your thoughts! ...

How to safely allow embed content?

Hi guys. I run a website (sorta like a social network) that I wrote myself. I allow the members to send comments to each other. In the comment; i take the comment and then call this line before saving it in db.. $com = htmlentities($com); When I want to display it; I call this piece of code.. $com = html_entity_decode($com); This w...

Calling A Javascript function from Silverlight

I'm attempting to call a javascript function (in our code) from a silverlight control. I'm attempting to call the function via: HtmlPage.Window.Invoke("showPopup", new string[] { "http://www.example.com" }); and I get the error "Failed to Invoke: showPopup" I can call HtmlPage.Window.Invoke("alert", new string[]{"test"}); without issu...

Javascript: loading mass amount of data in memory based on condition

I have many different regex patterns automatically loaded everytime my greasemonkey script starts. 95% of this loaded memory isn't needed at any stage, so I would like to find a way to not even put that data into memory to begin with if I know it won't be used. Take this a basic example: var patterns = [ { name : 'p1', ...

Changing arbitrary flash objects wmode to transparent

I need to change wmode of arbitrary flash objects to transparent from external js file to make sure they don't hide menus without using Jquery or similar libs. In FF I use getElementsByTagName("embed") and set attribute. It seems to work well. Specifically I'm having trouble with object set by swfObject library In IE7. swfObject creat...

Updating javascript references after minifying during build process

What are the best ways of updating javascript references after minifying them (I use YUI Compressor)? I am using ASP.NET mvc and have a bunch or javascript references in each file during dev. At build time (using MSBuild) I minify all the files into single file. At the same time I want to replace all the references with the single refer...

JavaScript/jQuery - offsetLeft and offsetTop

When hovering over a span I would like to get the offsetLeft and offsetTop values so I can make something hover near it. When I do this I get 0 for both values. What is a better way to tackle this? I am using jQuery. Assume I am starting with (looped by server-side scripting): <span onmouseover="hoverNearMe(this.offsetLeft,this.offs...

How can I get the size of a POST request in javascript?

Is there any way to get the size of a POST request in javascript? I want to check the size of a file before uploading it via a c# handler so I can tell the user to upload a smaller file. Thanks in advance. ...

Are there any JavaScript static analysis tools?

I'm used to having my compiler complain when I do something stupid like a typo on a variable name but JavaScript has a habit of letting this pass. Are there any static analysis tools for JavaScript? Preferably a free one (either beer or speech) because I'm a tightarse. ...

Javascript and only one Checkbox - undefined

for (i = 0; i < document.checks.user.length; i++) //for all check boxes { if (document.checks.user[i].checked == true ) { document.checks.submit(); return 0; } } <body> <form action="" method=POST name="checks" ID="Form2"> I have a bike: <input type="checkbox" name="user" value="Bike" ID="Checkbox1"> <b...

How can I simplify this Javascript function?

I'm trying to scale this but I'm a little green when it comes to creating JS functions. I managed to get this far on my own, but alas... When a span gets a value of whatever (in this case, a city name), I want the select box to automatically match it. And I want to scale this by getting rid of all these else if's. $(document).ready(fun...

rubber-banding multiple areas in javascript

I'd like to display the image, then let the user create multiple rubber-band selections on the image. Each mouse-down creates an additional selection. Has anyone seen an implementation of this technique in javascript? ...

jQuery dialog that darkens the screen like the link dialog does here

I like the look of the link dialog here. It darkens the screen and is probably modal (although I haven't tested that I just assume it is). What's a quick and easy way of darkening the screen like that witha jQuery UI Dialog? ...

In Javascript find if a checkbox is focused

In Javascript how can I tell if a checkbox has focus or not? I thought there would be a method or property called isfocused. But apparently not. By in focus I mean they've tabbed to it using the keyboard and at this point pressing space would check the box. ...

Javascript Event Handler for Print

I am trying to alter style at print-time: Is there an event in javascript that you can listen for for when file>>print is called? What is it? Also - is there a handler for when printing is finished? What is it? or if there is a better way to do this with some other means, such as style sheets, how do you do that? ...

replacing or managing json data from ajax request

I've got a page that makes an ajax request and gets data back in json format. I needed to sort this data before adding it to the DOM, so it is put into an object with the following code function(data){ var birthDates={}; var uids={}; $.each(data.users, function(){ if(!uids[this.uid]){ ...

How to disable AJAX-y links before page Javascript ready to handle them?

I am implementing a shopping cart for my website, using a pseudo-AJAX Lightbox-esque effect. (It doesn't actually call the server between requests -- everything is just Prototype magic to update the displayed values.) There is also semi-graceful fallback behavior for users without Javascript: if they click add to cart they get taken to...