javascript

How can I read the value of a radio button in JavaScript?

<html> <head> <title>Tip Calculator</title> <script type="text/javascript"><!-- function calculateBill(){ var check = document.getElementById("check").value; /* I try to get the value selected */ var tipPercent = document.getElementById("tipPercent").value; /* But it always returns the value 15 */ var tip = check * (tipP...

Must JsUnit Cases Reside Under the Same Directory as JsUnit?

I have installed JsUnit and a test case as follows: /home/chernevik/Programming/JavaScript/jsunit /home/chernevik/Programming/JavaScript/jsunit/testRunner.html /home/chernevik/Programming/JavaScript/jsunit/myTests/lineTestAbs.html /home/chernevik/Programming/JavaScript/lineTestAbs.html When I open the test runner in a browser as a fil...

How to remove focus from submit button

How can I remove focus from submit button? I don't know why it is there in the first plate, and it looks really ugly here is a screenshot : And here is how it should look like, it regains its appearance after I click beside it and hover it. ...

dynamically drawing polylines on googlemaps using php/mysql

Hi. I am new to the googlemaps API. I have written a small app for my mobile phone that periodically updates its location to an SQL databse. I would like to display this information on a googlemap in my browser. Ideally i'd like to then poll the database periodically and if any new co-ords have arrived, add them to the line. Best way...

add element to the DOM with JS

I want add element with JS. I have code: var collection = document.getElementsByTagName('body'); var a = document.createElement('div'); a.innerHTML = 'some text'; collection.item(0).firstChild.appendChild(a); and simple HTML: <html> <head> </head> <body> </body> </html> Where is mistake? ...

stopping backspace on multiple browsers using jQuery

I am attempting to stop a backspace keydown event from being handled by browsers, I'm using the jquery library, so I need to get the original event, but on some browsers (firefox at least) I get an error when trying to set the original events keyCode = 0, it gives and error saying that only a getter exists for that property. function bl...

Copying data across tabs

Hello, I got two different forms in two different tabs. One has data from our system and the other one is an interface of another, external, system in wich we need to copy data into (XML or API integration not an option here) The this is that, having open both forms - in two different tabs - i need a greasemonkey script or something si...

JQuery: Problem in getting element's width in Chrome

Hello, Suppose I have this image: <img src="images/01.jpg" border="0" rel="shadow" /> Then with JQuery, I get its width using: $('[rel="shadow"]').width(); Firefox and IE report correct dimensions of the image eg 140px while Chrome reports 0. How to solve this problem? Note: I don't want to set explicit width for images eg: <i...

Is my slide-to-anchor jQuery routine a correct use of JavaScript, or is there a better way?

I'm currently working on a project with a one page design that'll slide up and down between sections on an <a href> link... Currently, i have it written as follows: <ul> <li><a href="javascript:void(0)" onClick="goToByScroll('top')">home</a></li> <li><a href="javascript:void(0)" onClick="goToByScroll('artistsmaterials')">artist...

Getting value of "i" from GEvent

Hello, I'm trying to add an event listener to each icon on the map when it's pressed. I'm storing the information in the database and the value that I'm wanting to retrive is "i" however when I output "i", I get it's last value which is 5 (there are 6 objects being drawn onto the map) Below is the code, what would be the best way to get...

This app are using long polling ?

Hi at all, I want to know if this web app are using long polling or anything else "javascript trick": http://typewith.me/2wicOjuefI Is there a way to know that ? Thanks ;) ...

How can I use JSONP to download client-side javascript objects?

I'm trying to get client-side javascript objects saved as a file locally. I'm not sure if this is possible. The basic architecture is this: Ping an external API to get back a JSON object Work client-side with that object, and eventually have a "download me" link This link sends the data to my server, which processes it and sends it b...

button in the form cause it be submitted automatically

has the HTML version changed lately (like from ie7 to IE8?) I notice the following change that cause me some troulbe - I am having a code that is similar to this: <form method="POST" action="/admin/modify"> <input type="text"/> <button onclick="dosomething()">Press</button> </form> <script type="text/javascript"> function doSomething()...

php POST response

I am making a POST to another php file that I want to render in the browser. the jquery post function does not redirect to another page. it expects the app-display.php file to return data to it. have a look at the code. echo '<div class="showcase_URL"><a class="purl" name="'.$row->num.'" href="#">PROJECT URL</a></div>'; what I have...

mootools: $ not defined

I've strange error i don't understand. I'm just moving my code from jQuery over to Mootools because it's much cleaner than the jQuery mess. Now when i use the $$('div.canvas') in mootools i get the correct element. When i try $(document).getElement('div.canvas') it tells me that $ is not defined. How can $$ and all helper funct...

Is "long polling" the most efficient way to create a Web Real Time App ?

I want to create an application like this: http://typewith.me/2wicOjuefI What is the most efficient way to create this real time application ? Flash ? Long polling ? Http Streaming ? or anything else ? Thanks ;) ...

Extracting the most duplicate value from an array in JavaScript (with jQuery)

I have several array to deal with. I need to extract the most duplicate value from each array. From [3, 7, 7, 7], I need to find the value 7. Each array size is 4. For now, I don't have to think about when the most duplicate values are more than one such as [3, 7, 7, 7]. All the values are a number. I looked around the web. I found se...

Detecting position with drag-and-drop and jQuery?

Hi, I need to know how to detect the position of a dragged item as opposed to other divs. I need to detect whether an item is dropped outside of two different divs. (I am building a mac dock type start page and I need to know how to do this so I can delete icons by dragging them off the bar.) Any help would be greatly appreciated. ...

attaching div to a specific element for showing with javascript

Clicking on the image should show div near it (.show() in jQuery). But how can i attach div to that image? Is it done with pure css, or javascript? I tried several "position:absolute", but can't attach it near image. How it should be done? ...

Javascript: Collision detection

Hello, could someone please help me to understand how collision detection works in JS? I can't use jQuery or gameQuery - already using prototype - so, I'm looking for something very simple. Not asking for complete solution, just point me to the right direction. Let's say there's: <div id="ball"></div> and <div id="someobject0"></div...