javascript

Is there a better method than setting a variable to this?

In my javascript objects i found myself writing this: this_object = this; It seems it's the only way to pass member variables to external functions... google.maps.event.addListener(this.marker, 'click', function() { this.info_window.setContent('Chicago marker'); this.info_window.open(this.map,this.marker); }); That doesn't ...

ASP.NET Register Script After Partial Page Postback (UpdatePanel)

Hi Guys, I have a simple form (textbox, submit button) which is wrapped in an update panel. <asp:UpdatePanel ID="ReplyUpdatePanel" UpdateMode="Conditional" runat="server"> <ContentTemplate> <asp:Textbox id="ReplyTextBox" runat="server"/> <asp:Button id="SubmitButton" OnClick="SubmitButton_Click" runat="server"/> <...

javascript - get two numbers from a string

Hi I have a string like: text-345-3535 The numbers can change. How can I get the two numbers from it and store that into two variables? ...

Multilanguage support in my Javascript code

Hi, I'm using Django and I need to support multilanguage in my Javascript code. But my Javascript files are into site_media so they are not rendering by the template engine. I would like to learn what is the most common solution for this situation, how do you handle it generally? Thanks ...

javascript-canvas Uncaught Error: INDEX_SIZE_ERR: DOM Exception 1

OK, I have two versions of my code. The first appears to work (mostly) and the 2nd gives me the Uncaught Error in the topic name. defs: var VID_WID = 640; var VID_HIGH = 360; var OUT_WID = 480; var OUT_HIGH = 320; var NUM_WID = 3; var NUM_HIGH = 3; var TILE_WIDTH = VID_WID / NUM_WID; var TILE_HEIGHT = VID_HIGH / NUM_HIGH; var OUT_WI...

Is there a Javascript lexer / tokenizer (in PHP)?

I've seen a couple of Python Javascript tokenizers and a cryptic document on Mozilla.org about a Javascript Lexer but can't find any Javascript tokenizers for PHP specifically. Are there any? Thanks ...

Form submit button will not submit when name of button is "submit"

I am having trouble getting a form to submit when the name attribute of the submit button is precisely "submit". Here is the code: <input onclick="checkForm(document.form_29) && document.form_29.submit();" value="Submit" name="submit" type="button"> Note that we are not using a standard input type of "submit", but rather an input type...

html form radio value in an ajax loaded div

hello, i'm unable to get a radio value in a form loaded by ajax into a div. here is the javascript code i'm using. (the radio name is 'categorie_add' in get function) function getCheckedValue(radioObj) { if(!radioObj) return ""; var radioLength = radioObj.length; if(radioLength == undefined) if(radioObj.checked) return...

Using HTML/JS or another web solution to render a twirling ribbon

Any thoughts on creating a fluid/flowing ribbon for a website effect? I'm open to any ideas. Ideally I could do this simply with html and some js library, but I'm open to suggestions for doing this with flash also. Any links to tutorials or examples would be greatly appreciated as well. Thoughts? ...

uiwebview zoom text

I want to make a button that zooms the content of a html page like in the desktop version of safari. I think I might have to use javascript for this? if thats the case, how can I zoom a page with javascript? in UIWebView ...

Resize iframe by mouse drag

I have a page that consists of two iframes where they divide the page into two parts. Is there a way to resize the division of the page using mouse drag? I would prefer a solution that does not require JQuery as we're not using it at the moment (We are using Microsoft AJAX library but I couldn't find a solution that leverages it). T...

Using application locale folders instead of the project's

Hi, I'm using javascript_catalog view to have multilanguage support into my Javascript code. But because of this bug: http://code.djangoproject.com/ticket/5494 I couldn't make it. Basically, Django doesn't support this feature for project's locale folder, it only supports for application folders. So I need to have a locale folder for e...

Why is my jQuery script producing a double fadeIn?

I'm trying to use .fadeIn() to make my navigational hover effects look a little more smooth on the transition. Except I'm getting what I can only describe as a double fade (in and out and back in again). I'm brand new to JS and the jQuery API so any help appreciated. I'm an old pro with CSS, so I still think in those terms. On this one...

Javascript negative number

I want to check if a number is negative. I'm searching for the easiest way, so a predefined javascript function would be the best but I didn't found yet anything, here is what I have so far but I don't think that this is a good way: function negative(number) { if (number.match(/^-\d+$/)) { return true; } e...

Scope of THIS keyword in Function?

Should 'this' in the following code not still refer to the DOM object selected by the MooTools selector? $$('div').addEvent('click', function() { var click1 = function(){$(this).setStyle('background', 'red');} click1(); }); ...

How to deal with runscriptexception in watin

When I selected some option on a javascript generated select box, WatiN throw a runscriptexception. I do not know what does this mean. It seems watin needs some privilege to run the script behind. I wonder if I should use different way to handle javascript object. I appreciate for any help or suggestion. frank ...

How to get date between start date and end date? (excluding date on weekend)

Hi want to get a date list between start date and end date. For example start date is 27-08-2010 and end date is 31-08-2010. So the date list is 27-08-2010,30-08-2010 and 31-08-2010. 29-08-2010 and 30-08-2010 will be ignore because it is in the weekend. I attach the picture for more clearer explanation. How to achieve this using javascri...

JavaScript prototyping: single prototype object or not?

I don't really get JavaScript prototyping. Take this code, for instance: function Class(asdf) { if(typeof(asdf) == 'undefined') { } else { this.asdf = asdf; } } Class.prototype.asdf = "default_asdf"; Class.prototype.asdf2 = []; Class.prototype.change_asdf = function() { this.asdf = "changed_asdf"; this.asdf2.push("changed_asdf2")...

how do I dynamically create an object tag with jquery and add alternate content to it?

I am trying to embed a pdf into my webpage using an object that will fallback to an iframe which loads the pdf through an external rendering service for users that do not have acrobat installed. I am trying to do it like this: var container = document.createElement("div"); var object = document.createElement("object"); var iframe = doc...

How to get Youtube channel picture via username?

Any idea? I checked the Youtube API that doesn't support this feature. Is it possible? I need to get the thumbnail picture via username directly. for example: I got a username named: communitychannel and I want to get the following thumbnail picture: http://i2.ytimg.com/vi/YVrqydZz3e4/default.jpg ...