javascript

how to get the child node in div using javascript

Below is the structure of my div: <div id="ctl00_ContentPlaceHolder1_Jobs_dlItems_ctl01_a" onmouseup="checkMultipleSelection(this,event);"> <table cellpadding="0" cellspacing="0" border="0" width="100%"> <tr> <td style="width:50px; text-align:left;">09:15 AM</td> <td style="width:50px; t...

How can I intercept XMLHttpRequests from a Greasemonkey script?

I would like to capture the contents of AJAX requests using Greasemonkey. Does anybody know how to do this? ...

jQuery: Selecting an element in inside an already selected element

For example: $("table tr").click( function(event) { //Say, here i want get the data of td element where its class name="special" }); Is there any way I can select a element while in the click event, a element under the attached element above ( $("table tr") )? ...

Enabling back/fwd key events for an Ajax Application

I have an application which works heavily on AJAX. However I want to have navigation functionalities in it. To spoof the url, I am changing the location.hash, to generate URL. But if i use back/fwd, only the url changes, but page wont reload. How can I override the hstory.back to reload the page. ...

JavaScript triggering - reflection of vb.net api calls?

Can you call a vb.net api function using reflection from javascript code? I just started playing around with reflection, I have this snippet of code that works, I want to change it to a javascript page. Dim RawPlugin As Reflection.Assembly RawPlugin = Reflection.Assembly.LoadFrom("C:\Inetpub\wwwroot\demo\MasterApplication\getSession\bi...

Floating toolbar on bottom, centered, 80% of current screen width

I'm trying to implement a Facebook like toolbar on the bottom of the screen for a website I'm currently working on. Currently, I have it 100% of the width of the screen but I'd like to have it look almost exactly like Facebook's toolbar, centered, bottom justified on top, around 80% of the current screen's width. Here is the current CS...

how to access iframe parent elements?

What i am doing is a new image uploader, i want to put the input file in the iframe and show the uploaded images in the parent page. So how can i access the parent elements from the inner iframe? or if some one have an example, that will be nice as well. ...

Design patterns used in Gmail's JavaScript?

Can anyone tell me what design patterns (if any) were used when building Gmail? I understand the concept behind it - queue up some requests, increment the bar when each completes, init the display when all are down - but I'm specifically interested whether there's a specific design pattern I can use to mimic the features. ...

How can I restrict the use of other applications during an online exam?

I have created a online examination web application. I want the users to avoid using browsers (for checking answers in Google). How should I achieve this? Shall we have the full screen mode, even though I want to restrict minimizing the window or using Ctrl+Tab? Is it possible? ...

Keep value in html input box below set amount

I have in input box that can only contain numerical values (with use of this plugin). Now I want the input to be below, say 90. If a value is entered that exceeds this max cap or cannot be parsed, the previous value should be inserted. By default, the box will contain "1". <input id="targetQuantity" name="targetQuantity" type="text" val...

How do I autosize a blockui dialog to the available visible area with JQuery?

I need to resize a div shown as a message in blockUI so that it fills the visible screen area less some hardcoded fudge factor (so width - 100 say). The premise is that I can show a smaller image on the screen but if the user needs an enlarged image then I just show them block ui dialog sized to their screen. The image is dynamically ge...

Readability of nested AJAX callback functions

Please help me to refactore this Javascript code. There is big form for scheduled message sending(send date, reccurence type, end by date/qauntity, credits system - need to count total cost of scheduled sending plan in runtime). I'm writing Javascript validator for this form. There is an validation algorithm 1) check if send date time i...

prototype/javascript - firefox not firing keypress/keydown event unless focus is in textbox

The following works fine on IE6, IE7, and chrome. Not working on ff 3.0.7. <html><head> <script src="prototype.js" type="text/javascript" ></script> <script type="text/javascript"> Event.observe(window, 'load', function(){ Event.observe(document.body, 'keydown', myEventHandler); alert('window load'); }); function myE...

Set the Resource String in javascript

Hi guys, How can I set the resource string in javascript? I have a resource file called, for example, myResourceFile.resx in my code and using the literal control I can use: lblName.Text = Resources.myResourceFile.ajaxRetrievingInformation; <asp:Literal id="lit" runat="server" Text="<%$ Resources:myResourceFile, ajax...

RJS: Check for existing page element?

I have a textfield with the id "foo" that sometimes exists and sometimes not. If it exists I'd like to fill in a certain value. How do you do this by using RJS (in Rails 2.2)? I tried this and it doesn't work: if page[:foo] page[:foo].value = "bar" end I get TypeError: Null Value if the textfield doesn't exist. ...

Dynamically positioning pop-up "windows" (div elements)

I have a fixed toolbar at the bottom of my page where users are going to be able to change their online status and load a listing of their favorites among other things. In the toolbar, I have parent div elements that when clicked, pop up child div elements that need to be positioned directly above the parent element. For the online sta...

Using JSON in a Yahoo! widget

Haaylp! The Yahoo! Widgets spec says I can parse JSON objects using JSON.parse(). When I actually try this, and here is what I tried... var parsed = JSON.parse('{"key": "value"}'); print (parsed); for (p in parsed) { print ("prop: "+p); } I get: ReferenceError: JSON is not defined What's going on? Is further magic required? ...

JavaScript scope and closure

I'm trying to wrap my head around closures (there's a joke in there somewhere) and I ran across this: (function () { /* do cool stuff */ })(); How does this work? What's the purpose of putting the function in parens? Why the empty parens afterwards? ...

Javascript: return function with predefined arguments

I have a function like function a (p1, p2) { /* ... */ } and in some scope want to get something like this: function b (/* no params! */) { return a (my1, my2) } where my1 and my2 are defined somehow in this scope. So I should get a parameterless function b, which when called calls a with fixed parameters my1 and my2. Now, the ques...

JQuery getJSON - ajax parseerror

I've tried to parse the following json response with both the JQuery getJSON and ajax: [{"iId":"1","heading":"Management Services","body":"<h1>Program Overview</h1><h1>January 29, 2009</h1>"}] I've also tried it escaping the "/" characters like this: [{"iId":"1","heading":"Management Services","body":"<h1>Program Overview <\/h1><h1>J...