javascript

Javascript can implement OOP but Ruby can't implement functional programming?

Im new to "real" Javascript:ing and I know understand more of functional programming. It seems that in Javascript you get the best from both worlds: functional and object oriented programming. But in Ruby, you don't have first class functions (function as a datatype). Does this mean that Javascript embraces the best of the both worlds...

Jquery using the click function to just reference buttons

Hi I have this line in my script to reference any button click on my page $("input").click(function() { alert ("clicked") ; but_id = (this.id); }); It will then work on any input element but I cant seem to reference just a button . I thought this would work but is does not $("input :button").c...

javascript replace 2 characters

i would like to ask, how to replace char "(" and ")" with "" it is because i can only replace either ( or ) with "" instead of both how to achieve the goal?? that is original: (abc, def) modified: abc, def thanks my code: <html> <body> <script type="text/javascript"> var str="(abc, def)"; document.write(str.replace("(","")); ...

Hide (or disable) submit button when user clicks on it

I am working on development of an application using CakePHP framework. We all have clients that click several times on the submit button. How can I hide or (even better) disable the submit button when a user clicks on it? On the internet I found several Javascripts that can do it, but I need help to integrate it into my CakePHP script...

Meta tag redirect good or bad for search engines?

I have this meta tag to check if JavaScript is enabled: <meta http-equiv="refresh" content="0;url=http://www.example.com/activate_js.html"&gt; Is this bad in the eyes of search engines like Google, Bing and Yahoo? If so, what other "safe" methods are there? ...

CSS or javascript click hold function

I use a jquery draggable and I wanted to do is when I click and hold the header, the cursor turns to move cursor. I already tried css active and focus but nothing happen. ...

JS element style switching

I need to switch my element background image beetwin two images on every click on it. I have this, byt it swithes color just two times =\ <html> <head> <title>Javascript Change Div Background Image</title> <style type="text/css"> #div1 { width:100px; height:30px; background-image:url(blue.png); } </s...

Get metadata using javascript

Hi Everyone - Your help would be greatly appreciated I have the following code: It is suppose to get the metatags from a website: function calculate() { // This gets the title: g_title = ('' + document.title + ''); g_title_count = ('' + document.title.split(' ').length + ''); g_title_length = ('' + document.title.length...

jQuery looping animation

Hey all i am trying to get my code below to work in order for the "bug', when the mouse is moved over it, to animate like it's flying a little bit. Here is my current code: <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"&gt;&lt;/script&gt; <script type="text/javascript"> $(documen...

Finding Unicode character name with Javascript

I need to find out the names for Unicode characters when the user enters the number for it. An example would be to enter 0041 and get given "Latin Capital Letter A" as the result. Thanks ...

Need Help finding out howto use Twitter's @anywhere isFollowing/isFollowedBy methods

I am trying to check via the Twitter Javascript Api (see here) if a logged in user is following me on twitter. If not, i will display a followbutton. Right now i can't seem to find out how the command isFollowing/isFollowedBy works (see doc). Code so far: twttr.anywhere( function (T) { if(T.User.find('mashable').isFollowing){ ...

Explanation on "JavaScript - the Good Parts" example (section 4.15)?

Beginner in JS :) needs an explanation of code piece from Crockford's book, section 4.15: var memoizer = function (memo, fundamental) { var shell = function (n) { var result = memo[n]; if (typeof result !== 'number') { result = fundamental(shell, n); memo[n] = result; } return ...

what are all the different ways to include an external javascript file into a html?

Hi friends, what are all the different ways to include an external javascript file into a html? Please give me some examples. Thanks in advance. ...

What's going on in JavaScript when I use the "traditional" C-style function declaration?

I know that there are several ways to define a function in JavaScript. Two of the most common ones are: (1) function add (a, b) { return a + b; } (2) var add = function (a, b) { return a + b; } I am comfortable with the idea of a function as an object that can be passed around just like any other variabl...

Jquery: how can i restart toggle when another button is clicked ?

hello i have 2 buttons each of them has toggle function with 2 function inside the toggle. i have a problem that i want the toggle to be restarted if the user didn't click on the same button twice for example if the user clicks on X first function will fires if he clicks on Y and then re-click on X the first function will fires again...

Using Javascript to connect with server using protocol other than HTTP

Can Javascript be used to connect with a server with a protocol other than HTTP or FILE? Ideally, I would like to connect to an SMTP server using Javascript. ...

JSON parsing and printing JSON object with variable name

I'm having trouble printing an object with a variable name. It works when I hard code it. var objectVarName = "lat"; var obj = jQuery.parseJSON(JSON.stringify(msg)); // {"lat":"93"} is what JSON.stringify(msg) prints $('#display').prepend("<br/><br/>" + JSON.stringify(msg)); ...

Gathering data for evaluating website's accessibility, and evaluating it

Is anyone aware of any kind of ressources (projects, books, academic papers, etc) on inspecting a website's accessibility with javascript? (fully ajaxified websites, otherwise it wouldn't be possible with the precision I wish). I'm especially interested in evaluating the anchor paths followed by the visitor (read: graph theory). Note: I...

Open source chat room for Ruby

Do you folks know of a rails chat room package that fulfills these criterion? customizable very simple with no bells and whistles I am building a software with a chat component, and I was wondering if you folks had any idea there! ...

Other javascript frameworks like Jpolite for Netvibes like portal ?

Jpolite seems great any other ? ...