javascript

creating objects with new vs. {} in javascript

There are two ways of creating an object in javascript: use new on a "constructor function" return a dictionary {} and set the proper key/value pairs The first is, for example FooType = function() { this.hello = function() { alert("hello"); }; }; foo = new FooType(); foo.hello(); the second is fooFactory = function() { r...

Is it possible to link two jquery.ui draggables together?

I have two jquery.ui draggables. I am constraining their movement to the y-axis. If one is dragged to a certain y-position, I want the other to automatically move to the same y-position and vice versa. Has anyone ever linked two of these together before? ...

Keep aspect ratio with image width in css

Hi All, Is there a way to fix the aspect ratio of images given a smaller width using css? Maybe by using jQuery / javascript? Thanks! ...

javascript callback function and parameters

Hi Experts, I want to something similar to this. function AjaxService() { this.Remove = function (id, call_back) { myWebService.Remove(id, CallBack) } function CallBack(res) { call_back(res); } } so my calling program will be like this var xx = new AjaxService(); xx.Remove(1,success); function success(res)...

Should we use server-side solution in place of javascript as much as possible if we want to make same site accessible with Computer and mobile phones both?

Will mobile user get better performance and usability without JavaScript.? would it be good if we make site with pure css and server side programming for mobile? Opera MIni, iPhone safari, blackberry browser, Windows mobile browser, whatever? Graceful degradation takes time to implement. so if we go with pure css for fancy things and se...

How to change the Scroll bar color

Using Internet Explorer and FireFox I want to change my scroll bar color Code <div style="overflow: auto; width: 750px; height: 400px"> </div> The Above code is for Scroll bar, But How to change the scroll bar color. Tried code. <STYLE TYPE="text/css"> BODY { scrollbar-base-color: orange; scrollbar-arrow-color: green; scrollb...

unique object identifier in javascript

I need to do some experiment and I need to know some kind of unique identifier for objects in javascript, so I can see if they are the same. I don't want to use equality operators, I need something like the id() function in python. Does something like this exist ? ...

Client-side processing vs server-side processing , which is fast?

Which processing is fast Client-side or Server-side? for client side processing browser need to download every JavaScript first and in server side programming everything happens on server without downloading anything to user PC? if for a particular functionality we have solution in both javascript and php/asp then what should be chosen ...

Using Javascript Image object to handle images

I need to preview an image using javascript before upload to provide a crop facility. For this purpose, I create an Image object in javascript. var image = new Image(); To confine big images to a limited space, I access the height and width of the image using image.width and image.height For some of the images, I find that this value...

Javascript window close event rather than unload event for all browsers

Hi I want to alert a user while the user tries to close the browser with out siginingoff or without saving some settings. I am ding unload option in another page to alert unload data, but how can i alert a user on window.close(its not taking) window.onbeforeunload = confirmExit; function confirmExit(){ if(readCookie("onlineVD") ==...

how to print the content of a label or panel in asp.net?

Hi all, I have a label control in a page in asp.net 2.0 and a button Print. Clicking on print button I need to print the content of the label and I need same for a panel also. Is it possible to implement this? If yes then how to implement that? Please help. ...

How to send data using GET to Java Script

I wan't to know How to send data using GET to Java Script like from link: C:/folder/test.html?x=1 <script> //when page accessed //access x data sent in from the link </script> Note, this is for client page not server! ...

retype password verification not working

I used the following code: <script type="text/javascript"> function validate() { if ((document.changepass.newpassword.value != '') && (document.changepass.retypenewpassword.value == document.changepass.newpassword.value)){ document.changepass.retypenewpassword.blur(); document.changepass.submit(); } } </...

Strategy for external javascript framework debugging

Working with Extjs, GeoExt and OpenLayers, I more and more tend to run into problems which do not result in direct javascript errors (in either IE, FF or similar). It could be features not working, unexpected behaviour and so on. My usual strategy is to strip down code to a minimum hoping to discover where the problem arises - Firebug a...

how to determine the opera browser using javascript...

Hi All, i want to determine that the browser of the client machines in opera or not using javascript. Thanks in advance Avinash ...

CAPTCHA validation with JavaScript

I am trying to validate Captcha using JavaScript. But I could't find any resource about Client API's of Captcha. Do you have any documentation? ...

Echo PHP variable from javascript?

I have a php page with some javascript also, but this javascript below doesn't seem to work, or maybe I'm way off! I am trying something like this: var areaOption=document.getElementById("<?php echo @$_POST['annonsera_name']?>"); areaOption.selected=true; Also I have tried this, but it only alerts a BLANK alert-box: alert (<...

prevent page jump on .html and .append?

when i use jquery .html or .append to add elements in the DOM the page jumps to that location. how can i make it not jumping, cause i want my users to be able to click on "save thread to favourites" and it wont jump to "my saved threads" cause then the user has to navigate down in the list with threads again. EDIT: i have used this: ...

Custom confirm popup with ASP.net?

Hi everyone, In an asp.net project I am currently working on, I need to create a modal popup that will act like the confirm() javascript function. However, the native confirm() function doesn't help out, since a custom design is required. An earlier attempt for this using the SimpleModal jQuery plugin I split the confirmation and the a...

countdown timer in javascript

Does anyone knows countdown timer using javascript?? ...