javascript

Is there a problem with using all AJAX for server calls in a public site?

Understanding that if someone had JavaScript disabled the site would not work then is there any other reason not to do this? I am in the design phase of a new site and want to make it easy to change the server code without having to change the UI - just like a form. This is using Python server side. ...

ASP client-side validation woes

I have two questions regarding client-side validation in ASP, relating to the following setup: I have this bit of javascript which applies error styles to form elements if they fail to validate: var val = Page_ClientValidate(); if (!val) { var i = 0; for (; i < Page_Validators.length; i++) { ...

Function hierarchy

Hi all, How to solve huge hierarchy in JavaScript function? With Switch? Thank you. (Sorry, I am not native English speaker.) function do(param1, param2) { switch(param1) { case "write": /* another switch for param2 */ break; ... } } Example calls: do('write','house'); // write house do('return','house'...

How can I emulate the Jquery UI API?

I've written basic jQuery plugins before, but I'm struggling to get my head around something more complex. I'm looking to emulate the API of jQuery UI, which works like this: $('#mydiv').sortable({name: 'value'}); // constructor, options $('#mydiv').sortable("serialize"); // call a method, with existing options $('mydiv').sortable('opti...

jQuery : Running script in the address bar

In most web browsers, you can execute JavaScript in the address bar (i.e. javascript:alert('Test'); Is it possible to execute jQuery in the address bar? ...

Objects in JavaScript defined and undefined at the same time (in a FireFox extension)

I am chasing down a bug in a FireFox extension. I've finally managed to see it for myself (I've only had reports before) and I can't understand how what I saw is possible. One error message from my extension in the Error Console is "gBrowser is not defined". This by itself would be surprising enough, since the overlay is over browser.xu...

SharePoint - get logged-in user with ASP, manipulate with javascript?

Hello, I have an .aspx page built in SharePoint that I want to get the user name of the currently logged-in user (through ASP) and then manipulate it (using javascript). I'm getting an "object expected" error. Here's some of the code: function checkGroupPermissions() { var loginNameVar = document.getElementById("LoginName1").innerHTML;...

Something similar to java.util in Javascript?

Hi, I think Javascript is a fantastic language. I like all the little peculiarities, the inheritance model, the lack of classes, etc. Because of this I have never wanted to learn a framework as all of the ones I've looked at (jQuery, MooTools, Prototype, Dojo) force you to change how you write your code, in many cases it's not really ev...

[Javascript] How to iterate through multiple dropdown lists and access their option values

I'm writing the code for a basic GPA calculator. Basically, it's a 3-column-table, two text areas for the course name/credit hours and a dropdown list that contains letter grades (A+, C, B-) and their corresponding point values as the option value, like this <td><select name="letterGrades"> <option value="0.7">A+</option>> <option value...

YUI: String works, but a var containing a string doesnt?

var allRows = this.getTbodyEl().rows; for (var i = allRows.length - 1; i >= 0; i--){ var thisRowID = allRows[i].id; // Clean up any existing Drag instances if (myDTDrags[thisRowID]) { myDTDrags[thisRowID].unreg(); delete myDTDrags[thisRowID]; } // Create a Drag instance for each row myDTDrags[thisRowID] = new YAHOO.util.DDP...

is it possible to rotate a div on x,y,z axises ?

Hello i don't know if that's possible but i don't know anything about this, so i decided to ask. is it possible to rotate a div on x,y,z axises using javascipt library like Jquery ? or something like this? Thanks ...

document.onmousemove / onmmouseup prevent selecting text in IE input or textarea

whenever i alter the onmousemove or onmouseup attributes of the document, for example: document.onmousemove = myOnMouseMove; document.onmouseup = myOnMouseUp; It prevents me from selecting text in any input type='text' or textarea elements in internet explorer (have tried in ie7 and ie8, fine in firefox). If I remove either of...

How to create RollOver Effects in JS?

Ive seen buttons in html have RollOver effects but what else can you add this effect too ? ...

Googe Maps APIv3 - how to overlay multiple markers with diferent png images.

Hi all, I'm currently working on a project which involves plotting lots of custom markers onto a map, then creating a popup page when clicked. This problem i'm having, being a newbie at javascript is getting a second marker image showing on the map. So far, i have the following code, as you see, the 'camera' icons work... but needing the...

How do I format a timestamp in Javascript to display it in graphs? UTC is fine.

Basically, I receive raw timestamps and I need to format them into HH:MM:SS format. ...

using javascript, how can I count a mix of asian characters and english words

Hello, I need to take a string of mixed Asian characters (for now, assume only Chinese kanji or Japanese kanji/hiragana/katakana) and "Alphanumeric" (i.e., Enlgish, French), and count it in the following way: 1) count each Asian CHARACTER as 1; 2) count each Alphanumeric WORD as 1; a few examples: 株式会社myCompany = 4 chars + 1 word = 5...

Check if Javascript is Enabled (Serverside) with Rails

How would you check if javascript is enabled in Rails? So that I could do something like this in the views: <div> <% if javascript_enabled? %> <p>Javascript Enabled!</p> <%- else -%> <p>No Javascript</p> <%- end -%> </div> ...

Load image using referrer header

Greetings, I'm trying to load an image dinamically. Seems like the server doesn't like me loading that image outside form their domain, so I always get with a 404, when in fact Firebug seems to load it and FF as well. What's the best approach to remove the referrer header from the GET request sent to the server via the browser? I was t...

What are good resources for a backend developer wanting to learn client-side programming in the browser?

I want to learn how to write the Javascript/CSS/HTML side of my applications but I want to skip the CSS kludges, bad Javascript, and non-semanitic HTML of the past and jump directly to HTML 5, CSS 3, clean Javascript libraries. I've been reading Mark Pilgrim's Dive In HTML 5 which I think is awesome and now I'd like the equivilent books ...

django facebook login-button.

We are using django and django-socialauth , and my view is facebook/login what is the facebook login-button for django, thanks ...