javascript

referencing a javascript value before it is declared - can someone explain this

I'm hoping someone can explain to me why the below javascript/HTML will show "door #2" when the html is viewed in a browser: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"&gt; <html> <head> <script type="text/javascript"> function testprint() { alert('door ...

Appending a string variable in jQuery

I'm not sure if I have the syntax correct in the code below, I'm trying to append a var to a string parameter within the find function. I'm trying to search for a unique id within each input element of a particular form. //Get value attribute from submit button var name = $('#myForm').find('input#submitThis').val(); //Other code...

Javascript, Firebug: How do I have multiple views or what is the right of way of doing development?

Most of my javascript work is done with Firebug and I feel annoying most of the times having to switch between the HTML mode and console mode (which again I split into output mode and input mode). When I switch to a different page to see the HTML and come back, I lose the code that I write. What is the best way to go about developing jav...

ExtJs add, delete, update row to the grid

I need to enable the user to add a new row to the grid. The user may also update one or more rows. What is the best way to do this? I have tried to use RESTful Store Example, but have not been able to handle the REST posting with php. When the add record button is clicked, it fires the POST twice (once upon clicking, and once when p...

FireFox handling of disabled fields

I have an HTML form with a select list and a radio button, both of which are initially set with disabled = true. At some point, these elements are enabled via JavaScript (i.e., disabled = false). This works fine in IE and Chrome, but in FireFox the element remains disabled. It appears to be enabled, but doesn't respond to mouse clicks...

Extracting url from anchor tag to use in right click menu

Hey so I set up a right click menu on my site you can see here http://www.jaminproud.com Everything works good except I want to add the abilty to open a link in a new tab. I have looked everywhere and cant find a solid answer for this. I would also need a way to make the menu so that option is only displayed while hovering over an anch...

Javascript appendChild name property

So I'm trying to add attributes to a radio button input, specifically the name attribute in Javascript. I'm appending children to a main object and when I use Object.setAttribute("name", value); and subsequently check the innerHTML of the appended input, it does not even contain a name property at all! I'm guessing I'm missing something...

jquery and the style properties

where can i get informations how styles are written in jquery. for example it is not the normal way z-index it is zIndex... and so on.. fontWeight.. ...

declaration for variable in while condition in javascript

Hello In essence, I am trying to declare a variable in the condition-part of a while loop in javascript: while (var b=a.pop()) { do_sth(b) } Yet, my browser (firefox) doesn't accept that. Instead I have to go like so: var b while (b=a.pop()) { do_sth(b) } which works. Is this behaviour expected? Thanks, Rene ...

getting variable/object elements and values in javascript

I'm not sure if I'm using the correct terminology, so please correct me if I'm not. I've got a javascript variable which holds a group of values like this var my_variables = { first_var: 'starting', second_var: 2, third_var: 'continue', forth_var: 'end' } Now I'm trying to get th...

Calling Java methods in a GWT module via Javacript of a Google Gears worker in a workerpool

I would like to know if it would be possible to call Java method of a GWT module within a worker in a Google Gears workerpool. For example given the class and method of a GWT module. package com.mycomp; public class MyClass implements EntryPoint, WorkerPoolMessageHandler { public void mymethod() { ... }} I have tried defining the fo...

How to send JavaScript code to IE using C# (.Net 3.5), run it, then get a string return value from the JS code?

We are developing an application which needs to interact with the active document in IE. Context: The app is a C#, .Net 3.5 desktop app. The goal is to highlight specific text elements in the web page on user request. For this we need to retrieve and interpret web page elements (the need for the return value) then act on them through an...

How would you overload the [] operator in javascript

I can't seem to find the way to overload the [] operator in javascript. Anyone out there know? I was thinking on the lines of ... MyClass.operator.lookup(index) { return myArray[index]; } or am I not looking at the right things. Thanks in advanced ...

Preload Mouseover Images in Rails

I currently have a rollover button implemented in rails as follows: <%= image_tag("header/home_but.gif", :mouseover => "header/home_over.gif") %> How can I preload/cache the mouseover image (home_over.gif) so there is no delay when the user moves their mouse over the image? Thanx. ...

Using QMock with Internet Explorer

I'm trying to use qMock to test some javascript code, and am having problems in IE. The tests are passing in chrome and firefox, but in IE I'm getting "Object doesn't support this property or method" for every test that uses the mocked object. It's almost like IE doesn't see that there is a mock implementation of the function. Has any...

How to directly access (javascript) split values?

Is there any way to access split values without putting them into separate value? var content = "some|content|of"; var temp = content.split("|"); var iwilluseit = "something" + temp[1] + temp[2] How to do this w/o temp variable ?? (inline in setting of iwilluseit var) ...

Javascript RTE Plugin with character input limit

Is there a javascript RTE plugin which allows you to limit the input length by a certain number of characters, preferably displaying a character count as the user types? ...

Including HTML fragments in a page - methods?

heya, This is an extension of an earlier questions I asked, here: http://stackoverflow.com/questions/1519198/django-parse-xml-output-as-html-fragments-for-iframe Basically, we're looking at integrating various HTML fragments into a page. We have an small web app generating little fragments for different results/gadgets, at various URL...

Javascript/jQuery Regular Expression code issue

I am working with jqDock on a DotNetNuke project. I ran jQuery.noConflict() and went through the jqDock.js file and changed all '$' to 'jQuery' (though I don't think it was necessary). In this little bit of code I have an issue: altImage : function(){ var alt = jQuery(this).attr('alt'); return (alt && alt.match(/\.(gif|jpg|...

Dojo Tooltip appears in top-left corner of the page

I have a Dojo tooltip that's been initialized and it works perfectly find when hovering over the desired node. The problem is that once the tooltip shows up for the first time, when i'm no longer hovering over the "tooltip" area then the tooltip appears in the top-left part of the page. How do I hide the tooltip when i'm out of the "ho...