javascript

Code outline for auto-update pages

I want to mess around with realtime information, and there is a pretty standard functionality that I want to duplicate: It occurs here on SO when you're on a single-question view, typing your answer, and an alert pops up top saying "there are 3 news answers, click to show" It also occurs on Twitter "There are 5 new tweets in this searc...

Using SC.Timer to blink cursor

Hi I'm trying to have a cursor blink every 2.5 seconds but I'm not sure how tot use the SC.Timer object....The method I should be calling is _drawInsertionPoint(rect,context) every 2.5 seconds.... I found this var timer = SC.Timer.schedule({ target: this action: '_drawInsertionPoint(rec,context)', interval: 100, repeats: YES, until: ...

Adobe AIR and multiple XMLHttpRequests is being... weird

I'm making a small Adobe AIR app (my first) using HTML+Javascript. I need to run more than one asynchronous data request, but the second one didn't seem to be firing (note that the requests were not run concurrently originally). I tried stripping the program down to the bare minimum that exhibited problems, and at first only the first re...

Fastest / most efficient way to compare two string arrays Javascript

Hi I was wondering whether anyone could offer some advice on the fastest / most efficient way to compre two arrays of strings in javascript. I am developing a kind of tag cloud type thing based on a users input - the input being in the form a written piece of text such as a blog article or the likes. I therefore have an array that I ke...

What is the advantage of Gmail's client side web architecture?

Hello, I was just wondering what is the advantage of client side architecture GMail is following. I mean what is the advantage of multiple iframes on the page; one with html layout and second with all the javascripts? Isn't it more complicated to execute all the DOM operations? (you need to search trough js ifram<->top<->html iframe). ...

jQuery Keypad z-index issue with a modal dialog

Hi everyone, I'm using a jQuery modal dialog (see link) with an element that uses jQuery keypad (link). Firebug shows me that the keypad is coming up but behind the dialog. I tried using bgiframe() but it doesn't work. What could be wrong? $('.dialog').find('#test').keypad(); $('#keypad-div').bgiframe(); keypad-div is the div that ho...

.trim() in JavaScript not working in IE

I tried to apply .trim() in JavaScript in one of my programs. It's working fine under Mozilla, but an error displays when I try it in IE8. Does anyone know what is going on here? Is there anyway I can make it work in IE? code: var ID = document.getElementByID('rep_id').value.trim(); error display: Message: Object doesn't support thi...

Simple Javascript Map API

Basically I'm looking for something that would easily enable me to display a world map onscreen (most likely would consume the entire size of the window, not that this should matter) and get pixel based coordinates for certain real-world coordinates, which would then be used to visualize some data periodically obtained from the server (w...

Remove element with jQuery but leave text

I've got some html that looks like this: <div> <span class="red">red text</span> some more text <span class="blue">blue text</span> </div> What I want to do is use jQuery to remove all the spans within the div regardless of attached class, but leave the text within the span tags behind. So the final result will be: <div> red ...

FB.Connect.logoutAndRedirect(''account/logout') will not redirect, even with proper session

My init line: <script type="text/javascript">function initFB(){FB_RequireFeatures(["XFBML"], function(){FB.init("xxxx", "xd_receiver.htm");});}</script> My logout link: <a onclick="FB.Connect.logoutAndRedirect('account/logout');">Log Out</a> I have a valid session in my webapp, and a valid Facebook session, because my user display ...

Change CSS Element with JS,JS?

I have about 40 questions on a Question/Anwser script now I want to hide all the other messages then the one with the id clicked but the windows overlap, So how would I hide all the Other ids and show just one with Javascript? ...

how do I push variables onto web client for ajax?

Hey guys How do I use the PHP variable $contact['id'] in my ajax call? I'm trying to create a page that retrieves all notifications associated with a user. When the page load I already know the id of the user, how do I use this parameter in my ajax calls from the beginning? At the moment I am using the php preprocessor by splitting up th...

YOURLS Redirect with Javascript

Hello, Currently I am using YOURLS PHP URL shorterning script. In their functions.php, seems like they support both redirection which is with PHP header location and javascript. Functions.php I want to redirect with javascript, which will show me the message before redirect. I found this coding inside functions.php // Redirect to ...

Building object hierarchy from a 'namespace' string

I'm trying to write a function that takes a string representing a namespace (e.g. "MyCompany.UI.LoginPage") and defines each segment of the namespace as an object if it doesn't already exist. For example, if "MyCompany.UI.LoginPage" wasn't an object, it would evaluate this: MyCompany = {}; MyCompany.UI = {}; MyCompany.UI.LoginPage = {};...

width() not returning a value

I have an image in a page that I am trying to get the width of. <img class="zoomerIcon" src="zoomer.png" /> So I'm trying to get the width like this. var imageWidth = $('.zoomerIcon').width(); However the value is 0 unless I set the width property in the tag. Does width() only return a width greater than 0 if it's manually set i...

Best way to link UI elements with backing javascript objects

This is a rephrase of a post I made last week. I was surprised I didn't get more of a response, thinking maybe I didn't describe/title it very well. Simplest possible way to describe it: Is there something like spring:bind for javascript/dhtml? The high level view of what I want: In my app, I have a list of "subscriber" objects whic...

Displaying a string using window.open()

I have a page load event on view side where i want to display a string using window.open(). Since window.open() cannot be written directly under page_load I am building a string which contains window.open() syntax and which is passed further to RegisterStartupScript(). Actual URL passed to window.open will call a post method which will p...

silverlight with javascript

when i m trying to invoke javascript function which is present in my default.aspx page, it is showing some error --> Failed to Invoke: TalkToJavaScript. coding in my silverlight page is-- public MainPage() { InitializeComponent(); HtmlPage.RegisterScriptableObject("Page", this); HtmlPage.Window.Invoke("...

Detect in Javascript which form has been submitted

I have a rating system for a bunch of entries on a website, they are programatically placed in and therefore I have given them a unique form identifier by using a count. <form name="star"> <input type="radio" class="star" name="rating" id ="rating" value="Terribad"/> <input type="radio" class="star" name="rating" id ="rating" v...

wrap up html contents

if an html contains say <div>1222222222222234c dssdsdf sdfsdfsdf</div> how to wrap up the contents limiting to 10 characters and maybe after that we show (12222222..) two dots Thanks. ...