javascript

How to jQuery toggle multiple images on different button click ?

Hi Basically I have 4 images and 4 button. All 4 images are black and white. Button1 click -- > toggles image 1 from black and white to color image Button2 click -- > same for image2 Button3 click -- > same for image3 Button4 click -- > same for image4 So far my code is partially working. Problem is that when I click button 1 and...

YouTube: get youtube title+ image+description like facebook

How have they done this smart thing that when you paste a youtube link in "What are you doing right now?" then there comes up in Links, youtube picture + title + description? how have they done this, and is it hard to do? Example of doing this would be great! ...

Making a JavaScript script that gets out info from Youtube

Hello, so i continue from this question http://stackoverflow.com/questions/3081097/youtube-get-youtube-title-imagedescription-like-facebook` i got this answer: If you were given the video link http://www.youtube.com/watch?v=NWHfY_lvKIQ, you could get all the info about the video by using this link, http://gdata.youtube.com/feed...

How to do the "Paste And Show" function

Dont know what to call it, but if you have seen on Facebook, when you insert http://www2.scandvision.se/oresund10/images/body-background-1.jpg, it scales the picture down and show it besides the link, how to do something like that. To be detailed how to make a box you insert something and then after 1-2 seconds it shows the picture/in s...

Number of bits to represent a number

Hi, I'm trying to write a function to return the number of bits a positive integer less that the Javascript limit of (2^53)-1 is. However im being hit by precision problems, and want to avoid big integer libraries. Method 1: function bitSize(num) { return Math.floor( Math.log(num) / Math.log(2) ) + 1; } Pass: bitSize( Math.pow(2, 16)...

Loading bookmarklet in a window with disabled Navigation Toolbar

Everybody knows how to run a bookmarklet or some javascript on a window: just click on your bookmarklet, or type "javascript:function(){ etc. }" in the Navigation Toolbar. But here is the situation. I open a detached window in Gmail, for example a detached window to compose an email, or a separate window for chat. Now this separate wind...

JS: Insert youtubelink=youtube info

Hello. So ive got this far: $.get('http://gdata.youtube.com/feeds/api/videos/NWHfY_lvKIQ?v=2&alt=json', function(data) { var title = data.entry.title.$t; var description = data.entry.media$group.media$description.$t; var thumbnail = data.entry.media$group.media$thumbnail[0].url; // URL of the image a...

How do I make Opera Javascript save redirects to history so history.go(-1) works?

Hello there, I am using window.location* to redirect across a number of pages. There are 3 pages, a, b and c. a links to b b redirects to c I then use history.go(-1) in c to go back from c to b but in Opera it goes to a. What would work in Opera? This works in IE8 and Firefox, as it should. (* tried window.location.href too, still ...

Safari 5 Exentsions

I'm trying to teach myself Safari 5 extensions and I'm new to web development in general. Looking at the sample code, I see: <!DOCTYPE HTML> <script> ... </script> I'm just wondering, what language am I looking at? I see functions and code that almost looks C-like. Apple's documentation says it would be helpful to know HTML, javascrip...

Javascript to check Gmail Unread Count

How in javascript would get the number of unread emails for the currently signed in gmail account? Related question - does Google offer any documentation on this sort of stuff? ...

Custom Textarea for right to left languages

I need a custom text area inside which when the keyboard Enetr key is pressed sould insert new from right to left. and when back space is clicked at the beginning of that line shuold remove that line. ...

How exactly does the JavaScript expression [1 [{}]] parse?

Can you explain how the JavaScript expression: [1 [{}]] parses/evaluates? In Firefox, Chrome, Konqueror, and rhino, it seems to create an array with a single element, undefined. However, I don't understand why. In Firefox: [1 [{}]].toSource() produces [(void 0)] Replacing 1 with other JavaScript values seems to yield the sam...

javascript appending in a for loop not working but alering is.

I am trying to append to a string in a for loop. I can alert each value bieng looped but i cant append for some reason: <html> <head> <script type="text/javascript" language="javascript"> function doIt(){ var styleSheet = document.styleSheets[0]; var css=""; ...

bookmarklet: cannot find element added to the document

I am playing with bookmarklets. I add a frame to the document, and load some elements, like so: var myframe=document.createElement("iframe"); myframe.setAttribute('id','a_frame'); myframe.src='http://localhost:81/nframe.html'; document.body.insertBefore(myframe,document.body.firstChild); this is what nframe.html looks like: <form id=...

javascript correctly rounding up to two decimals, impossible?

In php, we have number_format(). Passing it a value such as: number_format(3.00 * 0.175, 2); returns 0.53, which is what I would expect. However, in JavaScript using toFixed() var num = 3.00 * 0.175; num.toFixed(2); returns 0.52. Ok, so perhaps toFixed is not what I want... Maybe something like this... var num = 3.17 * 0.175; v...

javascript arrays on gmaps

hi everbody, i'm newbie in javascript so, in this example exists the geometrycontrols.js (for global controls) and markercontrol.js (for marker controls) my problem is identify the arrays where "data" is saved... at the reference i see a savedata function but i have no idea how work with this function... on the other side, in test.h...

How do I get the reference to the dom node I just appeneded in JQuery?

I just appended some html to another JQuery object. I want to get a reference to the newly created dom node so that I can call another function on it. As seen in the code below, I am not getting a reference to what I wanted. Instead of the new node, I am getting the node with the original id. var a = $("#id").append("some_html"); a.live...

Dynamically Resizing Flash Object to Fill Window

I have a Flash/Flex object (Flashlight-VNC), which I would like to dynamically resize to fit the entire window after pressing a button in the Flex app. This would preferably happen without restarting the Flex app (and therefore the VNC session). I would just use the built-in Flash fullscreen mode, however Adobe's somewhat silly security ...

HTML PHP JavaScript Whatever to Check Gmail Unread Count

How do all these browser plugins, notifiers, etc. check your gmail unread count? I'm trying to write a Safari Extension (which happens to be in javascript but I don't think it matters) and I can't figure out how to parse the Gmail atom feed (https://mail.google.com/mail/feed/atom) to get the unread count. Thanks, ...

shorter conditionals in js

I have conditionals like this: if (foo == 'fgfg' || foo == 'asdf' || foo == 'adsfasdf') { // do stuff } Surely there's a faster way to write this? Thanks. ...