javascript

Wrap around javascript object to .Net usercontrol

Hi all, I have a question i don't know how to start with... We all know that DOM elements have their own events such as 'onChange'. Well a TextBox can fire onChange events and anyone can register to them. I have a .NET usercontrol with 2 textboxes (country code + phone). The textboxes are validated using a .NET CustomValidator. I have...

window.onfocus not firing in IE7, inconsistent in Opera

Note that this relates to focus and blur events on a window, not on form fields. I'm loading a document in a pop-up window, and it includes the following code: <script type="text/javascript"> window.onblur = function(){ document.title="BLURRED"; } window.onfocus= function(){ document.title="FOCUSED"; } </script> These functions are t...

How can i get value with javascript regular expressions

i have following text http://www.mydomain.com/#!/account/?id=17 and i am getting # with window.location.href which is giving me #!/account/?id=17 now i want to extract that id value with preg_match or any regular expression because that id value is dynamic... actually i am loading data with jquery ajax...please let me know the exac...

what happens when javascript array is treated like an object?

the index variable below is incorrectly initialized because f() will be returning stuff other than numbers, like strings. So what's the worst that can happen here? My testing seems to indicate that it has no effect, but now I am wondering... function index(o, f) { var index = []; // should be index = {}; each(o, function(k, v, o...

my jquery ajax request is not accessing the the database?

jQuery(function ($) { /* fetch elements and stop form event */ $("form.follow-form").submit(function (e) { /* stop event */ e.preventDefault(); /* "on request" */ $(this).find('i').addClass('active'); /* send ajax request */ $.post('recycle.php', { followID: $(this).find...

Animated height adjustment when innerHTML changes

I had this idea... let's say I have a DIV that contains some text. <div id="myDIV">Testing testing lorem ipsum</div> If I change the content of this DIV by doing something like $("div#myDIV").html("New text New text New text New text New text New " + "text New text New text New text New text New text New text New text " + "New t...

FadeIn javascript function in Safari not working but FadeOut works :(

So I've made custom function for a game I'm working on, one being fade in the other one fade out. The problem is fadeOut works, but fading back IN does not... strange. Any clues? See code below. THIS WORKS: fadeOut:function(o,duration) { o.style.opacity = 1; o._anim = function() { if(o.style.opacity <=0) ...

Dynamically update range value(s) for asp:RangeValidator

Validating a date range in a textbox; need to dynamically update the minimum value of the range. When you use a range validator in ASP.NET, javascript gets generated the first time the page is rendered to set the range, and after postback, setting the range values has no effect on the range used. Other than rewriting the validation a...

document.getElementById("").src - file path is changing, but image is not

I am simply trying to change the source of an image using JavaScript. Watching in Firebug shows me that when my function is called, the image paths are changing, however, the image itself is not switching. Has this ever occurred to anyone? ...

Creating a floating button

Hey all, I'm working on a Firefox extension and am out of ideas on how to implement a floating button. I need a button that is overlayed on my page that I can show/hide and dynamically position just about anywhere on my page. I thought I could do something like a fancy CSS tool-tip except replace it with button functionality, but that i...

Should functions be declared with a minimal scope?

In my experience, most JS functions, constructor functions, or module-pattern functions, are declared as globals or are bound to a global namespace object. In any case, these identifiers are globally accessible. From any line of code in your system you can have: mod1 = somepackage.SomeModule(); // couple to me! Here's a quick JS exa...

How to change a label value at runtime?

The alert is showing, but the value is not changing.... why? <html> <head> <title>Test EuDock</title> </head> <body > <label id="labelID">test</label> <script type="text/javascript" > document.onkeyup = KeyCheck; function KeyCheck(e) { var KeyID = (window.eve...

Jquery plugin using methods needs to call itself

I'm following the tutorial here: http://docs.jquery.com/Plugins/Authoring I just wanted to create a simple plugin for a project we are working on that would add +/- signs next to an input box that could be used to increment the value of the box. So I'm reading the tutorial and doing the section that talks about having multiple methods ...

How do I auto-reload a section of the page with jQuery without refreshing entire page?

So there are a few things I want to do. I have a section of HTML that I would like to be displayed on the page by default (i.e. the first time it loads). <div class="viewport"> <ul class="overview"> <li><img src="images/1.png" /></li> <li><img src="images/2.png" /></li> <li><img src...

Any custom map js component for iPhone (or just pan & zoom js component)

Hi there. I'm planning in developing a web app that will include a map-like page and it's targeted mainly to iPhone users. Is there any javascript library that can help me build a map-like component (using my own tiles / images) ? I found some that only work on the PC browsers, but none for the mobile devices. Something that will handl...

How do I move the mouse cursor when a key is pressed?

What do I put in my onkeydown to move the mouse to a specified [x,y]? ...

Javascript: Detect Changes to JS/DOM on the client side.

Is it possible to detect if someone has altered the DOM/JS code on your webpage in the browser? I'm thinking in terms of an online game written in JS, all the game code would be downloaded to the user's machine, which they can then edit to their will by using common script debugging/inspector tools. Are there any methods for detecting i...

Jump to content inside of a scrollable div.

Hello. I apologize if the title of this question is a bit misleading, I could not come up with a better name. I got the following HTML: <div style="height:200px;overflow-y:scroll;"> <table>.....</table> </div> With this setup I'm somewhat mimicking the expanded <select> control with @size attribute defined. So, that a user could ...

Need lexical context in eval for Javascript

I am writing a string parser that takes input like "{x} + 20" and evaluates the lexical value of x with the sum of 20 and returns. So var x = 10; var new = eval("{x} + 20".replace("/\{(\w+\}/g", "$1")); and here "new" should equal 30. How can this be done? ...

Javascript variable scope question

Hi, I'm having trouble resolving a scope issue with my javascript. I have an array, dog[] that is defined from JSON, that I need access to from inside a nested function. function blah(json) { for (var u = 0; u < json[0][1][u].length; u ++ ) { var dog = 'k' + json[0][1][u].doggies; console.log(dog); // prints array of doggie str...