javascript

auto partial page refresh in asp.net without UpdatePanel

I want to make auto partial page refresh in asp.net. There is UpdatePanel but it sends too much data. So I've found that I can make a webservice and call it by the JavaScript code. But I don't know how to call webservice automatic. There are many examples showing how to call webservice by the button click event: http://www.asp.net/ajax/...

how to do a "flat push" in javascript?

I want to push all individual elements of a source array onto a target array, tartget.push(source); puts just source's reference on the target list. In stead I want to do: for (i=0;i<source.length;i++) { target.push(source[i]); } Is there a way in javascript to do this more elegant, without explicitly coding a repetition loop?...

JavaScript bookmarklet in IE7

Hi, I am trying to get my JavaScript working in IE7 which works smoothly in all other browsers. document.write('<li><a class="bookmarklet" href="javascript:x=document;a=encodeURIComponent(x.location.href);t=encodeURIComponent(x.title);d=encodeURIComponent('+selection+');open(\'<?php echo createURL('bookmarks', $GLOBALS['user']); ?>?act...

What's name of this article rotating feature?

I developed article rotator where 5 articles with images rotate automatically and user can focus one (and stop rotating) by mouseover. Click will open the article. The article rotator is here: http://antizena.df.sk/ and it is just devel version. How to name it? What is the best name for this feature? ...

Verify an input file name on a form using regular expression

Hi, i need to verify that an input file in an html form is an image, i've made the follow code inside the html page, but don't work... script type="text/javascript" language="javascript" function valida(f){ var campo = f.immagine.value; //window.alert(campo); var er = /^+.[\.]([jpg]|[gif]|[png])$/; ...

javascript json - problem decoding ajax json array from php

Hello, I'm using php's json_encode() to convert an array to json which then echo's it and is read from a javascript ajax request. The problem is the echo'd text has unicode characters which the javascript json parse() function doesn't convert to. Example array value is "2\u00000\u00001\u00000\u0000-\u00001\u00000\u0000-\u00000\u00001...

Best Library for Real-Time Javascript Game with PHP Backend

Hi! I'm currently in the planning stages for a real-time multiplayer game that would be built using Javscript at the frontend and PHP on the backend and I'm just wondering if anyone here knows of any good libraries for such a game? Thanks, DLiKS ...

Need some JavaScript explanation for this code

Hi there, I know that it is bad practice to write code like this: var createBox = function(width, height, margin){ alert("Margin is set to " + margin); //margin is undefined in this context or why? var margin = margin || 2; alert("Margin is now " + margin); } createBox(0,0,0); But can someone please explain, why marg...

Javascript resize text as an image

Hi, I was wondering how to resize a div containing some text by setting a width and height so it would stretch to fill that area like an tag? E.g. when you set the width and height attribute of an image, it resizes the image to fill that area. I need to take an arbitrary width and height value and stretch a div containing text to those...

Help with regular expressions (JS replace method)

Hello, We would like to do a replace in our string like this: - Every time a \n (new line) or \t (tab) or \r (carriage return) appears, it should be replaced by the string "\n" or "\t" or "\r". For example, this string: "Hello, how are you? Fine thanks." Should be replaced by: "Hello, how\n\tare you?\nFine thanks." Could you help ...

sqlite between question

Before I rewrite an app I figured it's best to ask this question first. With sqlite, is it possible to do a between statement like this? select * from database where date between '2010-10-01' and '2010-10-31' As a side question, how do I get the last date of a month in javascript using the above format? ...

Keep the selection in a textarea

Hi guys :) Can I prevent the loss of selection in the "onblur" event ? <!DOCTYPE html> <html xmlns = "http://www.w3.org/1999/xhtml" xml:lang = "en" lang = "en"> <head> <meta http-equiv = "Content-Type" content = "text/html; charset=utf-8"> <script type = "text/javascript"> window.onload = function () {...

Clone div and rename element ids incrementally

Ok lets say I have div with form elements inside of it. I want to be able to clone that div with a button click using jQuery and add a version 2 of the form, so ALL of the element IDs will increment by 1 in their name. <div id="card"> <!-- PART 1 --> <h1 class="card_build">Build your card options:</h1> <select id="country...

jquery-tmpl - template function not working

Hey! The following code: jQuery(document).ready(function($) { function getBooks() { var query = "ajax.php?do=allbooks"; $.ajax({ dataType: "jsonp", url: query, jsonp: "callback", success: showBooks }); } function showBooks(data)...

What build systems exist for purely front-end code?

I'm looking to implement a build system that will run unit tests and JSLint on the Javascript, generate documentation and compress JavaScript and CSS into minified packages. I might also add an integration step, which automatically uploads the code to a server on each build. I feel overwhelmed by all the choices in build systems - some...

dynamic server time

Hi! As I understand there is no way I can get dynamic server time in IE with settimeout() in script.. I found this example: function timeExam(){ $.ajax({ url : "inc/clock.php", success : function (data) { $("#clock_time").html(data); } }); var func = function() { timeExa...

Pass multiple values in link

I have three values that I want to pass via a link, but don't want them visible in the URL. ...

How can I detect the Browser OS from Javascript?

I know nothing about javascript, and not a whole lot about programming, but I wanted to create a page which checked the user's os, and if they are using a mobile OS (iphone, android, etc...), forward them to a mobile website, and if they are using a computer, forward them to the normal website. Here is the page I made: <head> <title>O...

Javacript toString() problem..

hello.. i just want to ask if how to convert the number to String.. what i want to output is "000000" incremented per second "0000001".. i tried different methods but it will output to 1,2,3... i tried this but still won't work.. $(document).ready(function(){ xx(); var x = 0; function xx() { x++; if(x.length==5) { ...

Page stops rendering

Hello there, i have a JSP page that surprisingly stops rendering when its deployed to a server.But when i place javascript alert() at different positions on that page the page starts rendering as it should.Eventually , when i remove those alerts the page keeps on rendering.When i run that page on my eclipse as localhost it runs fine and ...