javascript

Dojo.dnd.source generateText property not taking effect with avatars

When using dojo.dnd with avatars, dojo automatically creates a span containing the number of nodes in the avatar to make sure, there is something shown while dragging. From the source of dojo.dnd.avatar: (..) span = dojo.create("span", innerHTML: source.generateText ? this._generateText() : "" (..) _generateText: function(){ // sum...

firefox addon : adding icon to context menu

Hello, I'm trying to build a firefox addon & I want to add image/icon in the right click content menu , for example, firebug had an icon in the right click context menu, http://i.imgur.com/GjGAV.jpg I wanna do something similar, my addon also consists of menu items structure of my addon in context menu : [icon] [menu] ...

Identify which object on screen clicked in html5 canvas javascript?

I'm making a game in html5 canvas. I'm using jquery so I can get the click event and the clicks x,y coordinates. I have an array of unit objects and a tiled terrain (also an array). The unit objects have bounding box information, their position, and their type. What is the most effecient way to map this click event to one of the unit...

How to split spaces in strings (cross-browser safe)

What is the best cross-browser practice to split spaces in a string with Javascript? I tried theString.split(" ") but i am having issues with IE and Chrome/Safari. Update Here's the js code. IE/Chrome throw error at line: 61 http://pastie.org/1151951 ...

Fastest way to build an XML request with jQuery

I am accessing a certain web service API which requires XML data in the request. For example, the API might be expecting: <?xml version="1.0" encoding="utf-8" ?> <root> <a>1</a> <b>2</b> </root> What's the easiest way to build that XML request, possibly using jQuery? Is there any standard serializer that I can use to build a ...

Google Maps not showing

Hello. I've been having a problem with Google maps API v.3. I have my canvas declared like <div id="map_canvas" style="width: 50%; height: 50%; margin-left: auto; margin-right: auto"> and in my Javascript function var myOptions = { zoom: 8, center: myLatlng, mapTypeId: google.maps.MapTypeId.ROADMAP } var mydiv=docum...

capture click on div surrounding an iframe

How can i capture a click or mousedown event on a div surrounding an iframe. I've tried attaching the funciton to click event on the div but since the iframe never bubbles the event up to the surrounding div the function is never called. Is there a way i can capture the event on the div and then propagate it to the iframe for default act...

HtmlDocument.InvokeScript Issue in .NET WebBrowser Control

I'm trying to make a wrapper around last.fm and need to invoke some of the javascript functions in the page. Particularly the ones for Stop, Skip, Ban and Love. InvokeScript seems to work fine with any script function that is within the page HTML itself, but not with scripts loaded from external script files. For example, the actual c...

xul : creating a right click context menu item for only hyperlinks

Hello, I got a question to ask on building firefox plugin, basically my aim is to do following things, 1) In my plugin I want to show right click context menu item for only links[anchor tags] and hide the menu item for rest of the page 2) How to add dynamic list to my menu, i.e., adding the number of menu list items dynamically dependi...

Javascript bind keyup/down event

How do I bind a function to the key down/up events? It can be either binded to the entire document or a single element, either will work in this case. This has to be without any JavaScript library. I am only primarily concerned with the latest Firefox. Particularly the canvas element. Ive tried this: (FF 3.6.9 Windows 7) <!DOCTYPE HT...

how he give me 0?

i have a var ID= "12,32,23,78"; var i = ID.split(','); if i do this then work fine but when it is only 12 then he give me 0. how i can solve this issue if i need to check if it have then how ...

Get hidden value set by JavaScript in JSF backing bean

I want to get a JavaScript value in a JSF backing bean. I've tried the following: JSF: <h:inputHidden id="fileName" value="#{TestBean.fileName}" /> <a4j:commandButton id="button" value="Send Mail" action="#{TestBean.send}" onclick="onCall()"/> Bean: public String send() { System.out.println("File Name: " + fileName); } JS: ...

objects in javascript

Primitive values are stored in a stack in javascript but objects are stored in a heap. I understand why to store primitives in stack but any reason why objects are stored in heaps? ...

php and javascript design

question relates to PHP and Javascript for now every table has a form with input tags that each of them has id="field_from_table" GLOBAL_TABLE=name of that table GLOBAL_FIELDS=name of fields in that table GLOBAL_ID=ID value for table. every field also have a label for im. some of the fields are not text. I want to get/set those inp...

How much time should i put into validating my HTML and CSS?

Hi all, I'm making some pages using html, css, javascript and PHP. How much time should i be putting into validating my pages using w3's tools? It seems everything i do works but provides more errors according to the validations. Am i wasting my time using them? If so any other suggestions to make sure i am making valid pages or if ti w...

Persistent database connection for Ajax Calls

I have ajax call which pulls from the processing script 'getajax.php'. Call is made to 'getajax.php' script which has the db connection details, select, functions, etc. My question is: Everytime a call is received by 'getajax.php' it will go through mysql_connect, mysql_select, then queries. Is this the correct aproach to handle thou...

Parsing multipart/mixed responses in jQuery

Good day. I'm new to jQuery, and have a passing familiarity with javascript, having spent most of my time on the server side. My interest is in posting in the browser a multipart/form-data form object consisting of one text field and one file. In response, the server returns a multipart/mixed response consisting of one part html or js...

javascript \" \' im confused

Hey, I'm busy on little JavaScript item, but I got confused by the next rule; <a href="#" onclick="removeMap('+ \"test\" +')" style="float:right; margin-right: 30px;"><img src="images/icons/collapse.gif"></a><br/>' It doesn't take the onclick remove map action. I don't know what I have to put between the () to make I can put text ther...

Javascript function change variables scope

I am attempting to declare a function outside of anonymous function but still have acess to all of the anonymous functions variables Below is demonstrating what I'm talking about. I just need to get rid of eval. //Used to determine where the variable is being stored var variableScope = "global"; (function(window){ var variabl...

remove key press delay in javascript

Hello, I have the following problem: I'm trying to write a javascript game, and the character is being controlled by the arrow keys. The problem is, when one keeps the key pressed, there is a short delay between firing the first keypress and the repeated kepress. Also, when one presses the "right arrow key" and keeps it pressed, and then...