javascript

Is it possible to listen for changes to an object's attributes in JavaScript?

I'm working on a fiddly web interface which is mostly built with JavaScript. Its basically one (very) large form with many sections. Each section is built based on options from other parts of the form. Whenever those options change the new values are noted in a "registry" type object and the other sections re-populate accordingly. Havin...

Can I target an element before it's closed?

I'm wanting to add a class to the body tag without waiting for the DOM to load, but I'm wanting to know if the following approach would be valid. I'm more concerned with validity than whether the browsers support it for now. <body> $("body").addClass("active"); ... </body> Thanks, Steve ...

Auto start print in html/javascript

Is there anyway to automatically run: javascript:window.print() when the page finishes loading? ...

How do I select an item by its text value in a dropdown using jQuery?

If I had the following select, and did not know the value to use to select an item in advance like in this question or the index of the item I wanted selected, how could I select one of the options with jQuery if I did know the text value like Option C? <select id='list'> <option value='45'>Option A</option> <option value='23'>Option B<...

Modify XML document inside the browser

Is it possible to modify/write data to an XML file without any server-side proxy(e.g. a php or asp script)? Can this be done via javascript? XSLT? ...

How can I pop-up a print dialog box using Javascript?

I have a page with a "Print" link that takes the user to a printer-friendly page. The client wants a print dialog box to appear automatically when the user arrives at the print-friendly page. How can I do this with javascript? ...

Decimal comaprison in Java script

I am trying to compare two decimal values in Java script. I have two objects as one assogned value "3" and the other as "3.00". When i say if (obj1 == obj2) it does not pass the condition as it is does the string comparision. I would instead want it to do a decimal comparision where 3 = 3.00. Please let me know how to do this. ...

Disable browsers vertical and horizontal scrollbars

Hi guys, Is it possible to disable the browsers vertical and horizontal scrollbars using jQuery or javascript? ...

Why does Date.parse not return a Date object?

today1 = new Date(); today2 = Date.parse("2008-28-10"); To compare the time (millisecond) values of these I have to do the following, because today2 is just a number. if (today1.getTime() == today2) Why is this? ...

Strange javascript error in ASP.NET TreeView control

I’m using Treeview Control (ASP.NET 2.0) in a web control. The funny thing is, that everything is working fine : expanding, collapse, selecting a node etc. ,but after every click firebug shows an error : TreeView_SelectNode is not defined [Break on this error] HelpFile.aspx (line 1) The error comes up every time I'm selecting a node. I'v...

Relative Positioning of DIV

Hi there, There is div named "dvUsers". there is an anchor tag "lnkUsers". When one clicks on anchortag, the div must open like a popup div just below it. Also the divs relative position should be maintained at window resize and all. How to do that using javascript/jquery? ...

How do I retrieve the name property of a radio button in c#

I've created a series of radio button controls in C#. (radCompany, radProperty etc.) I've set their group name to be the same (282_Type) so they function as a list of radio buttons. How do I retrieve the name (like: ct100$m$dfgadjkfasdghasdkjfg$282_Type) in c# so I can use this in a Javascript method i'm creating? The values output a...

When to Use Double or Single Quotes in JavaScript

console.log("double"); vs console.log('single'); I see more and more JavaScript libraries out there using single quotes when handling strings. What are the reasons to use one over the other? I thought they're pretty much interchangeable. ...

JavaScript foreach Vs for

Do you think there is a big difference in foreach and for loops? What kind of "for" do you prefer to use and why? Let's say we have an array of associative arrays: var myArray = [{'key': 'value'}, {'key': 'value1'}]; So we can iterate: for (var i = 0; i < myArray.length; i++) And: for (var i in myArray) I don't see a big differ...

Cross Browser dropdown/popup menu over a flash movie

I need to make my dropdown menu apprear over the top of a flash movie, how is this done cross browser? It can be done, IBM do it: http://www.ibm.com/us/ so do GE: http://www.ge.com/ Setting the the WMODE to transparent doesn't work for Firefox Putting it into an Iframe doesnt work below IE7 Any one know the best way to achieve this? ...

Looking for a good treeview widget for Scriptaculous

Is anyone using a good Treeview widget for Prototype or Scriptaculous? If so, why did you choose this one? It has to support dynamically generated data, and drag'n'drop. Note: I found TafelTree, which looks nice. Anyone has worked with it? Thanks! ...

Problem with NetStream.pause() in ActionScript called from Javascript

Hello, I am working on a very simple player written in MXML+ActionScript whose functions are exported to be called by a simple Javascript in an HTML page. Both codes are provided below. For the mp3 "path" all is working perfectly for playing, pausing, resuming and stopping... For the m4a "path", starting is working well, stopping too b...

Simple Website (Apache/PHP/MySQL + JavaScript)

I've been asked to create a fairly straightforward website for a friend. Essentially a user will log in, fill in a set of information, and submit it. This data will then need to written to a database (and read from/presented at a future point). I'm not really a web developer (I do mostly Java/C++), but about 3 years ago I worked on a pr...

Why are hidden form elements still read by JAWS?

The Situation I have an area of the screen that can be shown and hidden via JavaScript (something like "show/hide advanced search options"). Inside this area there are form elements (select, checkbox, etc). For users using assistive technology like a screen-reader (in this case JAWS), we need to link these form elements with a label or ...

Unexpected behavior of window.onback in JavaScript?

I'm using window.onback = history.forward(); to prevent users from resubmitting data. I know it's a hack and I don't like it either, but that's not what this question is about. The problem is that the code prevents other pages from going back to the page with the code. Let me clarify. PageA.aspx has the JavaScript code in it. The user s...