javascript

Dojo to jQuery migration

I have this code: dojo.declare("City", null, { constructor : function(cityid, cityinfo){ } }); dojo.declare("TPolyline", GPolyline, { constructor : function(points, color){ }, initialize : function(map){ }); What should be it's jQuery equivalent? ...

Align an image where the source is set by javascript

Hi- I'm putting the network solutions 'seal' image on my site and they give you a javascript that sets the image. I'm wanting the image to align>right. However, if you want the image, they give you a javascript code stub and it handles the rest, which has no alignment property. I've even tried putting the javascript into a table that ali...

Pagination: Server Side or Client Side?

What is it best to handle pagination? Server side or doing it dynamically using javascript? I'm working on a project which is heavy on the ajax and pulling in data dynamically, so I've been working on a javascript pagination system that uses the dom - but I'm starting to think it would be better to handle it all server side. What are e...

How to display Yes/No Button in asp.net page using Javascript

I have to display yes/no button on some condition on my asp.net page , I used windows.confirm() to display that but windows.confirm displays Ok/Cancel Button , Is there any way I can display Yes/No Button in asp.net page instead of Ok/Cancel using Javascript ? ...

How to make this jQuery function more elegant?

On my page I have a drop-down select box, with a default value of (empty). When the user selects an entry, the appropriate form for that entry type is displayed. Couple of problems.. The code is not DRY and seems more verbose than it needs to be, so not easily maintainable / extensible. When a user selects something, fills in the form...

jQuery selection with dynamic id's.

I have a form that is dynamically generated, and has dynamically generated id's (and potentially classes). The forms are the same but they have the related id tacked on to the end. How can I select each set of inputs and apply code to each one? I was experimenting with $('input[id^=@id_airline_for_]') but could not get it to fly. I sus...

Setting cross-domain cookies in Safari

Evernote's bookmarklet is able to do this, therefore the most upvoted answer does not answer this even though the bounty will go to it (in a non-productive manner). I have to call domain A.com (which sets the cookies with http) from domain B.com. All I do on domain B.com is (javascript): var head = document.getElementsByTagName("head"...

Javascript file uploads

Any alternate thing in javascript to make a file upload control ? ...

Any JavaScript Frameworks with the aim of standard based cross-platform JS and DOM?

Hi, I'm trying to find any JavaScript frameworks whose sole aim is to standardize the DOM and JavaScript across all browsers. What I'm not looking for is frameworks which create their own API to solve these common problems. I want something that will allow me to call for example myElement.dispatchEvent("click") in Internet Explorer. Not...

change width more than 32767 with jquery

I want to make a mini timeline with jquery and this timeline have width more than 32767 px. When I change it by jquery $(".timelinecontainer").width(32767); in Opera does not change it, but in others browsers it works. What can you give me advices ? Sorry for my English :) ...

Top-Rated JavaScript Blogs

I am currently trying to find some blogs that talk (almost solely) on the JavaScript Language, and this is due to the fact that most of the time, bloggers with real life experience at work or at home development can explain more clearly and concisely certain quirks and hidden features than most 'Official Language Specifications' Below f...

Javascript order of execution - How come it does this?

I am quite on lost on why Javascript does certain things in this way, or maybe I coded something wrong. But how come the code after $.getJSON gets executed before the callback is complete? window.ratingCallback = function(data){ if(data[0].code == 3){ ratingHTML = buildHTML(0); console.log('a'+ratingHTML); ...

What the best pratices to place ads in a website?

I want place ads in my website, but I'm unsure about the commom pratices to place thes ads. By example, some cool asp.net articles sites shows ads in the middle of the article! So you read 2-3 paragraphs, read some ad, then finish the article reading... Another worry is about sabotage. One of mine customers get their Google adsense acco...

Vector graphics in Javascript?

One of the advantages of Flash/Flex is that you can use vector graphics (SVG), which is nice. I did a bit of searching around and came across this Javascript vector graphics library. It's pretty simple stuff but it got me thinking: is there any possibility of using vector graphics files such as SVG with Javascript/HTML or it just can't...

What's the best alternative to an out of control switch statement?

I have inherited a project that has some huge switch statement blocks, some with 20 cases, what is a good way to rewrite these? ...

Resize jquery UI dialog with JS?

Even better would be if autoResize in latest branch would work as intended, but till then the question is simlpe: how to resize a dialog once it is created? ...

How can I make a button like 'Digg it' for my website?

Hello, I've got a blogging site hosted on Windows Sever, ASP.Net 3.5, ASP.Net AJAX, SQL Server in background. I want to give bloggers a button like 'digg-it' which they can put on their blogs for the readers to click to thumb-up the post if they like it. I know I'll be using Javascript to do that. What can I do to: - Retrieve code f...

Using jQuery for first time, simple problem!

I have some markup like this: <p><a id="1" href="#">Link 1</a></p> <p id="1show" class="starthidden">Hi! I get shown when link 1 is clicked</p> <p><a id="2" href="#">Link 2</a></p> <p id="2show" class="starthidden">Hi! I get shown when link 2 is clicked</p> <p><a id="3" href="#">Link 3</a></p> <p id="3show" class="starthidden">Hi! I g...

What's causing these javascript validation errors (Implied global and already defined var)?

Could anyone explain me why: function doAjax() { var xmlHttpReq = false; try { // Firefox, Opera 8.0+ and Safari xmlHttpReq = new XMLHttpRequest(); } catch (e) { // Internet Explorer try { xmlHttpReq = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { xmlHttpReq = new ActiveX...

How best to determine if an argument is not sent to the JavaScript function

I have now seen 2 methods for determining if an argument has been passed to a JavaScript function. I'm wondering if one method is better than the other or if one is just bad to use? function Test(argument1, argument2) { if (Test.arguments.length == 1) argument2 = 'blah'; alert(argument2); } Test('test'); Or function...