javascript

What is the JavaScript equivalent of var_dump or print_r in PHP?

Hi, I would like to see the structure of object in JavaScript (for debugging). Is there anything similar to var_dump in PHP? Thanks ...

jQuery equivalent selectors

Are the following exactly equivalent? Which idiom do you use and why? $('#form1 .edit-field :input') $('#form1 .edit-field').find(':input') $('.edit-field :input', '#form1') $(':input', '#form1 .edit-field') ...

Possible to get the current mouse coords with Javascript?

Possible to get the current mouse coords with Javascript? ...

How can we access the value of a radio button using the DOM?

How can we access the value of a radio button using the DOM? For eg. we have the radio button as : <input name="sex" type="radio" value="male"> <input name="sex" type="radio" value="female"> They are inside a form with name form1. When I try document.getElementByName("sex").value it returns 'male' always irrespective of the che...

Dynamically Resizing an Iframe

Hello All, I can see that this question has been asked several times, but none of the proposed solutions seem to work for the site I am building, so I am reopening the thread. I am attempting to size an iframe based on the height of it's content. Both the page that contains the iframe and it's source page exist on the same domain. I ...

javascript: insert rows into table

What is the best plain javascript way of inserting X rows into a table in IE. The table html looks like this: <table><tbody id='tb'><tr><td>1</td><td>2</td></tr></tbody></table> what i need to do, is drop the old body, and insert a new one with 1000 rows. i have my 1000 rows as a javascript string variable. the problem is that table...

Saving raw html of a dynamically created page

I'm writing an application that would allow users to edit a calendar, its description and a few other things. I'm using jquery, php and mysql. Each time the user makes a change it asynchronously updates the database. I'd like to give them the option of turning what they make into a pdf. Is there a way that I can post to my server the ra...

Can a Greasemonkey script override AdBlock filters?

I have a Greasemonkey script that is trying to access an HTML element that Adblock is disabling. Is it possible to create a workaround with the Greasemonkey script to prevent conflicts with the Adblock plugin? I'm open to any ideas, however changing the script to avoid the Adblock element is not a solution at this time. Additional Info...

How can I determine the absolute position of an element within an iframe taking in to account the frame's scroll in javascript?

I'd like to know the absolute position (pixels from top and left) of a HTML element within an iFrame that has scrolled. I've tried using the 'findpos' script from quirksmode (http://www.quirksmode.org/js/findpos.html): function findPos(obj) { var curleft = curtop = 0; if (obj.offsetParent) { do { curleft += o...

jQuery Slide Toggle Not Working - Resolved

On the first click, it works as expected: the class is changed and the html content is changed from 'Show...' to 'Close...' the content area is expanded with the slideDown effect, Good so far. On the second click, ... the class changes the html content is changed from 'Close...' to 'Show...' The content area does NOT go away as e...

Delivering a javascript library for web developers

This is a broad-based question around delivering a javascript library that other web developers will use on their site. Here's the scope of my library: I'm providing a data service that's delivered in the form of a JS file. A similar implementation would be Google Analytics. Will always be hosted by me. Developers will simply use the ...

How to display a message on screen without refreshing like SO does?

The best example of this is through SO. You can be viewing a question, and without refreshing the page you will get an orange message at the top of the screen letting you know you got a badge and check your profile. This all happens without refreshing the page. I am curious how you go about doing that? I am going to guess something wit...

Yahoo Compressor

Any one know how can I apply Yahoo Compressor (YUI compressor) on my website? ...

how would you debug this javascript problem?

I've been travelling and developing for the past few weeks. The site I'm developing was running well. Then, the other day, i connected to a network and the page 'looked' fine, but it turns out the javascript wasn't running. I checked firebug, and there were no errors, as I was suspecting that maybe a script didn't load (I'm using the ...

Interesting test of Javascript RegExp

I wrote a Javascript RegExp test to detect date string format, I added an redundant "g" flag by mistake and found something interesting. var s = "2009/03/10"; var regex=/^\d{4}[/]\d{2}[/]\d{2}$/g; alert(regex.test(s)); alert(regex.test(s)); alert(regex.test(s)); alert(regex.test(s)); I got a 'true' followed by a 'false', then another...

Is function declaration allowed in function call for ActionScript?

I have the following code: var a= 1 + (function (x) { return x+1;} (2)); This is allowed in JavaScript, but in ActionScript, it's always show an error message, saying this line of code is wrong. I cannot find a documentation on ActionScript about this, anyone has any idea about it? Thank you in advance! I have a idea as : var a = 1...

How can I "filter" JSON for unique key name/value pairs?

I've got some JSON data that is giving me a list of languages with info like lat/lng, etc. It also contains a group value that I'm using for icons--and I want to build a legend with it. The JSON looks something like this: {"markers":[{"language":"Hungarian","group":"a", "value":"yes"}, {"language":"English", "group":"a", "value":"yes"},...

Is it possible to detect East Asian language support?

I'm working on a javascript memorization game that requires that japanese characters to be displayed. Is there a cross browser way(s) of detecting support for asian languages, or japanese specifically? window.navigator.language will be set to the language of the browser but misses out people who don't set japanese as their browsers lang...

Find first day of previous month in javascript

Given a date object, how to get its previous month's first day in javascript ...

How do I get the first day of the previous week from a date object in JavaScript?

given a date object,how to get previous week's first day ...