javascript

Applying certain CSS to images over specified size.

Here's my predicament; I'm working on a simple iPhone site (it's a port for my blog). I have this issue; In order for my blog to at least look somewhat nice, I need to put a boarder around every image over a certain size, and then center said images. The site's content is literally an RSS feed displayed with some simple javascript and ...

Safari 5 extension to load a URL without opening window

Hey everyone, I'm fairly bad at javascript, but here's what I want. I have a PHP script on my server, and when a user presses my Safari Extension button, I want a request (url) sent to my server (www.myurl.com/directory/script.php?etc), but I don't really want a new window/tab opening to load it. Is there a way load it in a hidden windo...

How do I get a breakup of my Lines Of Code?

Is there a tool that calculates various LOC statistics? It would have to support popular languages like C++, C#, Python, PHP, JavaScript, ActionScript, etc and interpret code accordingly. An example of the statistics I'm looking for: 350 Physical lines of code -- including braces 200 Logical lines of code -- actual code 190 Comment li...

How to make ExtJs DatePicker in my MVC site ?

Hi. I need a datepicker widget via ExtJs on my pages that works like this. All I found in ExtJs are DatePicker and This sample with pickers The problem is that standart DatePicker looks like just a huge calendar with "today" button. The sample gives picker that looks like i want(textbox field and calendar on demand) but it works in ...

How can you sort an array of GPS coordinates to draw a non-overlapping bounding box?

I have a collection of GPS coordinates (Lat/log) in an array that I want to use to create a polygon in google maps. If i use the unsorted array, the polygon lines are drawn in the order of the array index. I am wondering if there is a way to sort the array such that when i draw the polygon, the borders do not overlap. Any insight will ...

How to create a 2d array of zeroes in javascript?

Is there an easy way to programmatically create a 2d array in javascript? What I don't want: var array2D = [ [0,0,0], [0,0,0], [0,0,0] ] ...

Dynamically changing form action URL has no effect

Hi, When a form action URL was changed dynamically, when the form submit, it will still use the default action URL, anybody know why? Please see a simple example below: <form action="test.php" method="get" id="test"> <select name="id" onChange="formSubmit(this)"> <option value="abc">abc</option> <option value="xyz">xyz</opti...

Mail through Javascript

How can we send mail using JavaScript? ...

Parse Javascript variable with Python

How can I convert a Javascript variable (not JSON format) into a python variable? Example Javascript variable: { title: "TITLE", name: "NAME", active: false, info: { key1: "value1", dict1: { sub_key1: "sub_value1", sub_key2: "sub_value2", }, dict2: { su...

how to get the id of all selected checkbox in jquery?

i have a checkbox who have class= check how i can get id of all checkbox in javascript ...

Case-insensitive switch-case

OK, so let's say I have this: $(function() { $('#good_evening').keyup(function () { switch($(this).val()) { case 'Test': // DO STUFF HERE break; } }); }); ... this would only run if you typed "Test" and not "test" or "TEST". How do I make it case-insensitive for JavaScript functions? ...

replacing a dropdown menu with a text menu in javascript

I'm trying to replace a drop down menu I have with a text field if someone chooses the "other" option. Right now in my code I have it replacing it with a paragraph element because I'm too lazy to find the exact constructor arguments for setting up a text field. However, when "other" is selected nothing happens. Does anyone know what's w...

Comparing Sizes in jQuery

Hey guys, I'm currently learning jQuery, and I am curious about something. For functions that return sizes in strings, like say: $(".some-class").css("line-height"); // => "18px" Is there a way to compare them? For example, if I want to see if it's at least a certain size before doing something? I'm not actually planning on using th...

Does JavaScript have the equivalent of Python's __getattribute__?

Does JavaScript have the equivalent of Python's __getattribute__? In the sense that I'd like an object, a, for which a reference to a property x is equivalent to a.__get__('x'). Trying to get this to work in V8. Possible? Example: an object which makes REST-ful calls: RESTful("some-url").foo({x:1}) => response of call to "some-url/foo?...

Which Javascript functional library: Underscore or wu.js or Functional or ... ?

I am building a node.js app and wondering which javascript lib to add to my repertoire. Current short list includes: Underscore wu Functional Bonus points for something that works in the browser (so I can use it on both client and server). Any ideas? Advice? Opinions on the above? Something else I should investigate? ...

How to redirect to a particular link if checkbox is checked using javascript?

How to redirect to a particular link if checkbox is checked using javascript? I am doing this but its not working for me.. <input type="checkbox" name="yousendit" id="yousendit" value="1" onselect="return yousendit();"/> <script type=javascript> function yousendit() { if(document.getElementById('yousendit').checked== "checked"...

how to invoke form submit from javascript?

i am developing a online test website using PHP. i have set time limit for the test and i have used javascript to run the timer. what i want to do is to submit the form with answers when the time runs out. please help me to do it. ...

Override default jQuery selector context

I'm trying to use jQuery inside a Firefox extension, and actually want to use jQuery to manipulate the DOM of the current page, as opposed to the context of the XUL file. Thus, I load jQuery in my XUL file, and pass it to some of my scripts in a sandbox (using the Greasemonkey extension compiler http://arantius.com/misc/greasemonkey/scri...

Howto create a AJAX request with JavaScript that contains both file and post data

How can I create a HTTP request that sends one file and some post data with JavaScript that can be received by a PHP server? I have found the following suggestion but it does not seem to be complete xhr.open("POST", "upload.php"); var boundary = '---------------------------'; boundary += Math.floor(Math.random()*32768); boundary += Mat...

FB.api() error occurred - FB undefined

Hi, I got error occurred when trying to post to wall on facebook using the below code. It sometimes can post after the first login but always return error later on. <?php include_once "include/settings.php"; //include_once "include/messages.php"; if(isset($_GET["access_token"])) { $access_token = $_GET["access_token"]; }...