javascript

DOM when not an actual document

Ok, lets say I go to http://www.google.com/intl/en_ALL/images/logo.gif , which is not really a document, but an image, iin my browser. Does it still have a document object? Can I use javascript: in my location bar? Wha'ts the deal with this? Thanks. ...

getElementById not playing nice with Radio Buttons

I am guessing getElementById doesn't work with radio buttons when you want to get the value of it or to find out if it is checked? I say this because I did this: <input id="radio1" type="radio" name="group1" value="h264" checked="checked" /> <input id="radio2" type="radio" name="group1" value="flv" /> To get the value of the selected ...

Javascript keyup/keydown in .NET WebBrowser Control

Hi all, I have a .NET WebBrowser control that I am using to display some javascript-heavy pages that I've written. The pages use YUI and have been built in a way to be portable. I have just discovered that while I can capture keypress in javascript, I cannot seem to capture keyup or keydown in javascript. This prevents me from hooking ...

IP Address Lookup in a Firefox Extension

I'm writing a Firefox extension and I need to find the ip address of the currently loaded page. I can get the hostname of the page with window.location.host, but is there any way to find the ip for that hostname? I tried looking for the answer at the Mozilla Developer Center but was unable to find anything. EDIT: I would use something...

JS: Specifying current element in the menu

Hi! I have a menu: <ul> <li id="active"><a href="/">Головна</a></li> <li><a href="/about/">Про компанію</a></li> <li><a href="/work/">Діяльність</a></li> <li><a href="/initiative/">Ініціативи</a></li> <li><a href="/statti/">Статті</a></li> </ul> Can you suggest a way to change id=active attribute for this li...

Convert JSON to HTML Tree

Hi, I would like to generate an HTML tree (preferably UL-LI) from the JSON example below. Does anyone have a simple, recursive JS function (not a framework) that can handle this specific structure? Thanks for your help! { "folder" : [ { "title" : "1", "folder" : [ { "title" : "1.1", "folder" : [ { "title" : "1.1....

Please Review my JavaScript Code

I am a novice to intermediate JavaScript programmer. This is some of by best code. I'm not sure if this community is looking for stuff like this, but I'd be very interested to get some critiques on this JavaScript comment widget I wrote. I have a couple of mentors, but I can never get enough code review. It seems to improve my code by ...

Supply extra parameter to autocomplete according to Zend Framework

I have a form with (at least) the following two fields: country club The club is a field that is generated via the ZendX_JQuery_Form_Element_AutoComplete Element, that also generates the following javascript code: $("#club").autocomplete({"url":"\/mywebsite\/\/mycontroller\/autocomplete"}); I have a database of clubs per country. ...

automating web activity which includes form submission, javascript, and SSL

I'm attempting to automate login into my small community bank, navigating through several links, and then downloading the .OFX. I can't seem to find a good open source tool which is robust enough to handle this case. Automation frameworks like mechanize can't handle the Javascript. I need this to be run in a graphic-less environment (v...

jQuery plugin feedback

I'm new to building jQuery plugins. I have seen and used a lot of tooltip plugins, and today I've decided to build my own. Can I get some feedback on the code? What work, what doesn't. Optimizations. Caching. What can I do to make it faster and better? This would be really helpful for my learning and hopefully for others too. Heres my...

Reliably detecting text overflows in TextFrames in InDesign Server using javascript scripting?

I'm doing some Javascript scripting with InDesign Server at the moment. I'm having trouble trying to reliably detect overflows in TextFrames, after changing formatting or placing XML into them. For example, I've got a function that shrinks a 4 column TextFrame's height until the text overflows the frame. Then it increases the height unt...

Problem with HTML? Scrollbars Not Appearing via window.open

I have a VB.NET web application where I am opening a window when a user clicks on a link to view some external tabular data. The data I'm displaying definitely requires a vertical scrollbar in order to see everything...For some reason I cannot get a vertical scrollbar to show up when the new window loads. Here's the JS that opens the wi...

Problem with "this.function" and Scope in my code

Hey I have this code right here: http://pastie.org/534470 And on line 109 I get an error saying "TypeError: Result of expression 'this.allVarsDefined' [undefined] is not a function." Scope in javascript is confusing to me. Can anybody see what my problem is? Also do you guys know of any articles that would help me learn about scope in ...

(Rails,Javascript) RJS "Can't find variable" error not providing detailed information.

Hi All, I'm having an issue with rails involving javascript. Basically, I have the following code: <ul id="all-points"> <%for point in Point.find(:all)%> <%domid = "point[all][#{point.id}]"%> <li class="available-point" id='<%=domid%>'> <span> <%= link_to_remote "ADD",:url => {:action => "add_point"}, :html ...

How do I generate dynamic items dynamically?

Hi All, I'm looking for a way to append elements with javascript using javascript. Basically I have two lists of items. One has a list of items with an "ADD" button (using "link_to_remote") and the other has a list of items with a "REMOVE" button (using "link_to_remote"). When I click the "ADD" it immediately places the item into the...

Parsing XML namespaces?

Using JavaScript/Ajax? I'm trying to extract values from: <yweather:astronomy sunrise="6:34 am" sunset="8:38 pm"/> Looking for something like: var response = transport.responseXML.getElementsByTagName("channel"); sunrise = response[0].getElementsByTagName("yweather:astronomy").item(0).Attributes["sunrise"].Value; But nothing wor...

Using google transliteration in Flex

Attached code is an example of how to use Google transliteration feature in certain html textboxes. I need to enable the same transliteration feature for a flex application. Is there a way I could do it? <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> <script type="text/javas...

Implementing COMET clientside

I have read up about what COMET streaming is, and all the various hacks required to get it working across the major browsers. The problems encountered seem to be two fold: 1. Server being able to support many persistent connections 2. Implementing the JS functionality I have an application where I need to perform COMET streaming. I have...

Extract substring between two tokens. Second token could be missing

Good day, I need to extract portion of string which can looks like this: "some_text MarkerA some_text_to_extract MarkerB some_text" "some_text MarkerA some_text_to_extract" I need to extract some_text_to_extract in both cases. MarkerA, MarkerB - predefined text strings. I tried this regexps, but with no luck: ".*\sMarkerA(.*)Marke...

Assorted jQuery questions

1.) What's the difference between these two queries, exactly? $( "#orderedlist li" ) $( "#orderedlist>li" ) 2.) In the jQuery file itself there is a function that returns the following: function now(){ return +new Date; } What does that mean? I've never seen +new before. 3.) In a brief skimming of a tutorial, I observed the f...