javascript

Delete table in all the rendering pages of a single page in Javascript

I am having a table like: <table id="toc" class="toc" border="1" summary="Contents"> </table> in many pages. All these pages are rendered in a single page. When I apply the javascript to delete that using on load with the below: var tbl = document.getElementById('toc'); if(tbl) tbl.parentNode.removeChild(tbl); Only one table is del...

Do I need specifically iPhone SDK 3 to develop new iphone apps within the current release of Titanium?

I was asked to inform myself about how to make iPhone apps using Javascript/CSS and HTML. Well i realized that there are some nice frameworks to work with, like Titanium or PhoneGap for example (if you know some more, feel free to post some names or links). But my biggest problem now is that generally, when i'm about to develop native a...

Jquery dynamic dropdown event not firing

Hi i am trying to create dropdownlists dynamically and populating the contents via an ajax call, this sort of works in the sense that the drop down is created and populated as required but its 'change' event does not fire. I am posting the code below, if anyone can spot something obvious, can you please let me know regards $(document).r...

Alternative to before </body> tag inline Javascript

I know inline Javascript is frowned upon and with the new on-the-fly Javascript compressors that check for idle/unused function usage and omit the unused code, it seems good practice to have all your Javascript in an external file. My question is, in situations like FOUC (flash of unstyled content) which usually require little snippets ...

Slide HTML element using jQuery's mousemove() event

Hello, I would want to move a DIV element in a container when I move my mouse horizontally (X axis). I found this piece code http://nnbox.ca/demo/mousetrack/ that does almost what I want, but there the movement is on the Y axis. Here's my code, modified from the original one: function mouseTrack() { var xLeft = $("body#homepage #secon...

add(a,b) and a.add(b)

how can i transform a method (that performs a+b and returns the result) from add(a,b) to a.add(b)? i read this somewhere and i can't remember what is the technique called... does it depends on the language? is this possible in javascript? ...

Lifetime of javacript variables.

What is the lifetime of a variable in javascript, declared with "var". I am sure, it is definitely not according to expectation. <script> function(){ var a; var fun=function(){ // a is accessed and modified } }(); </script> Here how and when does javascript garbage collect the variable a? Since 'a' is a part of ...

is there any way to pass string contains '+' via the Querystring

I need to pass '+' via the QueryString. some special character can be passed by using 'Encode' .. but '+' I know the one solution, If I replace '+' with other character. But it's not the perfect solution. [edited] well I used escape() javascript function to encode. escape function can't encode + . is the another function...

ASP RadioButton Client Event Not Triggering

Hey, I'm dynamically generating radio buttons in my code behind and assigning javascript to them as they are created. This javascript will change the value in a hidden field for when a postback is eventually triggered (autopostback on the buttons is disabled). I am using the exact same method with ASP ImageButtons and it works fine bu...

Firebug profiling issue: "no activity to profile"

I want to try some different options with some javascript (jQuery) to see which is the fastest, however I can't get profiling working properly. Here is the code I want to test. $this.keypress(function(e) { console.profile("test"); //retrieve the charcode if possible, otherwise get the keycode k = e.which ? e...

How to add a background to text only ?

I have a background image on top of which there is some text. It is very hard to read the text because of the background. I would like to add a white background just around the text itself, such that the text could be easily read. How can I accomplish this using CSS/Javascript/jQuery ? ...

jQuery autocomplete. Doesn't reveal existing matches.

Hello fellow engineers. I have come across a problem I just can't solve. I am using autocomplete plugin for jQuery on an input. The HTML looks something like this: <tr id="row_house" class="no-display"> <td class="col_num">4</td> <td class="col_label">House Number</td> <td class="col_data"> <input ty...

Javascript knocks out CSS:hover??

Hi im trying to make the Product Categories menu work on this page: http://www.jaybrand.co.uk/p1.html at the moment the page loads and CSS hover works to set the background position so that the graphic behind makes a roll over effect. i put some javascript to set the background position to the roll over on click, but this knocks out t...

How to use keyword this in a mouse wrapper in right context in Javascript?

Hi, I'm trying to write a simple wrapper for mouse behaviour. This is my current code: function MouseWrapper() { this.mouseDown = 0; this.OnMouseDownEvent = null; this.OnMouseUpEvent = null; document.body.onmousedown = this.OnMouseDown; document.body.onmouseup = this.OnMouseUp; } MouseWrapper.prototype.Subscribe = funct...

How to change the font size in table cells according to cells content ?

I have an HTML table which has incrementing numbers starting from 0 in its cells (left to right, up to bottom). I fixed in CSS the width and the height of the cells (40px width, 25px height, in my case). When the table becomes larger, the numbers inside it becomes large also (for example, the last number is 1266356). This causes the ce...

async or sync ? when we set the src property of the Image object?

var img=new Image(); img.src='xxxxx'; //will the browser wait for the image then exec the next code line? ...

jQuery plugin to style objects

Hi. I've been looking at the various JavaScript UI libraries and am wondering if there's one that can add some styling to page elements. I'm currently adding rounded corners, shadows, borders, and gradients via my own CSS + hacks to get it working on IE. I'm using jQuery for a number of tasks and wondered if there's a plugin that can ad...

[Javascript] Linux Ajax (mootools Request.JSON) Header error

Hi all, I use the following code to get some json data: var request = new Request.JSON( { 'url': sourceURI, 'onSuccess': onPageData } ); request.get(); Request.JSON is a class from Mootools (a javascript library). But on linux (ubuntu on firefox 3.5 and Chrome) the request always fails. So i tried to ...

toggleClass messing something up.

Hi I am using playing around with the Pretty-checkboxes-plugin and have a problem. The plugin can be seen here http://aaronweyenberg.com/90/pretty-checkboxes-with-jquery As you can see, this uses two links to select and deselect. I want it to only use one link and then change the class to make it work the other way the next time it is c...

Poorly performing regex

I've a really poorly performing piece of regex, currently it makes Firefox, Chrome and IE hang for a period of time. Here's the reg-ex: ^([a-zA-Z0-9]+[/]?)+[a-zA-Z0-9]+$ It's kind of a url matcher, but should only match the requested path (not starting with or ending with a slash). Valid examples: Segment Segment/Segment segment/...