javascript

Select div using wildcard ID

How to select a div using it's ID but with a widcard? If the DIV's ID is statusMessage_1098, I would like to select it in some way like document.getElementById('statusMessage_*'). This is because until the page is generated, I don't know the suffix of the ID and only one such ID will be present in a page. Is this possible? Thanks for ...

how to capture all changes to the contents of a <body> element in JS

I am trying to write an extension for Google Chrome. I want to capture any keyboard input on a given page, and do something magic to it. I am able to do most of what I need with these lines: document.addEventListener("keydown", function(event) { OnKeyDown(event); }, false); document.addEventListener("keyup", function(event) { OnKeyDow...

Chrome Browser Action click not working

I am trying to create chrome extention, however my browser action click does not work! I've tried pretty much everything. Here is my setup: manifest.json: { "name": "blah", "version": "1.0", "description": "blah", "browser_action": { "default_icon": "icon1.png", "popup": "popup.html" }, "permissions": [ "bookmarks", "tabs", ...

JavaScript to invoke C# Web Service in an ASCX User Control

I have an asp:dropdownlist, and when a user selects an item, I am supposed to update an area next to with some information based on the selected value of the dropdownlist. Since I am using user control, I apparently can not use page method. So I decided to use web-service, but I do not know how to properly invoke it. I do not have body ...

Telling Firebug to Break as Soon as any Javascript is Executed

I've inherited a pile of code that's doing unexpected things when I click on some <button> elements. The page has a lot of Javascript, and it's unclear what, if any, events have been setup on the button or its parent elements. I'm trying to find where execution starts so I can debug what's going on. Is there a way to have Firebug (o...

go back to last state ajax pages?

i've got a website that shows search results with ajax. but of course when i click on a thread in the results and then go back with the web browser back button the results are gone. is there a way to go back to same result page displayed by ajax? cause i really want to use ajax for certain tasks, but it wouldnt be nice if the user has ...

AES equivalent in Ruby openssl?

Gibberish library provides a nice CBC algo... // In Jascascript GibberishAES.enc("Made with Gibberish\n", "password"); // Outputs: "U2FsdGVkX1+21O5RB08bavFTq7Yq/gChmXrO3f00tvJaT55A5pPvqw0zFVnHSW1o" # On the command line echo "U2FsdGVkX1+21O5RB08bavFTq7Yq/gChmXrO3f00tvJaT55A5pPvqw0zFVnHSW1o" | openssl enc -d -aes-256-cbc -a -k passw...

Issue with showing a progress bar using overlay

Requirement : I have a piece of code similar to the code below. I want to show a progress bar in an overlay after the save button is clicked. Once I get the response from the ajax call, I show an alert displaying that the operation was successful.Issue : The overlay ( progress bar) is visible only after we have got the response from the ...

How to use external JavaScript file in Facebook application development?

How can I use the external JavaScript in Facebook application development? Actually I want to use the Ajax tab feature in my application. ...

jQuery sum values from items above

I have small problem. What I want to achieve is adding sum of values from above elements to each one. For example every position have got it own time value hidden in attribute. I can get it by using jQuery var time = $(ui.draggable).attr("time"); now we got 4 positions with time as follows: 432 sec 123 sec 5634 sec 654 sec Now I ...

Enable checkbox B only when checkbox A is enabled and the other way around.

I have a two columns of checkboxes with predictable names. How can I disable a checkbox in column B when the ones in column a is unchecked and only enable it when the first the checkbox a is enabled? <dmf:checkbox name="someNameAColumnNumber" value="true" onclick = "enableColumnBCheckBox" runatclient="true" /> Is there somethi...

JavaScript: What is the performance gain by optimizing Name Lookups?

The company I work at bought us (or rather me) the jQuery Cookbook by O'Reilly which I am reading from front to back. Now I am at 5.13 which talks about Name Lookups. It claims that given the right circumstances, code which is optimized regarding Name Lookups can have an up to 70% performance boost. In one very situational example, it cl...

How to load external css, js and append a div to the DOM from a bookmarklet?

Hi, I'm trying to build a bookmarklet that does the following: 1.)loads an external js, located on my server (done) javascript:function%20loadScript(scriptURL)%20{%20var%20scriptElem%20=%20document.createElement('SCRIPT');%20scriptElem.setAttribute('language',%20'JavaScript');%20scriptElem.setAttribute('src',%20scriptURL);%20document....

PHP variable to JS - over and over

Sorry my Gods, but.... I have php, file, and in this php i set the language, and include the necessary lang file: ... if ($lan=='ge') {$_SESSION['lang']='german';...} if ($lan=='en') {$_SESSION['lang']='english'; ....} } if ($_SESSION['lang']=='english'){ include ..english }else{ include ...german } I u...

javascript/css replacement for <select>

Yeah sorry I actually asked this question already except I dont think anyone understood what I was asking. I am asking how to produce an html list which is styled as in this picture below: http://iforce.co.nz/i/dafjj52d.png where by there is a custom background/button for the actual list dropdown action. I've seen this done using a jQ...

open a new window with post values enhancements

var projectWindow; function btnNew_Click() { var form = document.createElement("form"); form.setAttribute("target", "projectWindow"); form.setAttribute("method", "post"); form.setAttribute("action", "MySite.aspx"); document.body.appendChild(form); var hiddenField = document.create...

window.location problem

Hi, I am facing on strange problem in ie6. When i am using window.location to redirect page through javascript it works fine in all browser except ie6. It works in ie 6 if i place just like below: <a href="javascript:void(0);" onclick="javascript:window.location('http://www.demo.com');"&gt;demo&lt;/a&gt; but its not working for bel...

Javascript: invoke default keydown event handler

I'd like to invoke default keydown event handler from javascript. Is it possible? ...

Javascript: Using object's field's value to determine another object literal's field's name

I want to use object's field's value while creating another object using literal notation: var T = { fieldName : 'testField' }; /* // Doesn't work. var test = { T.fieldName : 'value' }; */ // Does work. var test = []; test[T.fieldName] = 'value'; alert(test.testField); // test But it doesn't work. Is there a way to solve th...

Meta Refresh: Count starts after page load or before?

<meta HTTP-EQUIV="REFRESH" content="0; url=http://www.yourdomain.com/index.html"&gt; Does the count start from full page load or as soon as the page is loading. Having tested it, it looks to me it starts counting after full page load? I appreciate a confirm before I continue with this solution. I didn't like Javascripts timeout. Wil...