javascript

How do I install a Yahoo! Connected TV Widget on a TV so I can test it?

I am developing a Yahoo! Connected TV Widget (using tools including the simulator provided by Yahoo!) How can I install my widget on a real TV so that I can test it? ...

How do I make an object change it's direction smoothly?

I have a simple Javascript program that displays a small rectangle in a canvas. The rectangle moves towards the mouse position. When it changes direction, it does so with sharp corners. As in, if the rectangle left a line behind, when I move my mouse in a circle, the rectangle would draw a tilted square. What I'd want to happen, is that...

What's the best way to create a JavaScript namespace?

I have not yet found a common way on the Internet for creating a namespace in JavaScript. What's the best way to create a namespace (and please list any downfalls that particular approach might have). ...

text search in javascript ?

I have a page with more than 200 links with this kind of formatting. <h1> <a href="somelink">Somelink</a> some text that explain the meaning of the link. </h1> Now, to make it bit easy to search through this link, i have put a search box. My requirement is to search through all this tag and find the links that are relevant to t...

Selecting Data on JavaScript popup menu using Selenium

I am using Selenium to test out a web site. The web site contains a date field, which when clicked, opens a popup from wherein I can choose the date. My issue is that I wish to select a particular date using the Selenium IDE or Selenese. I have tried various methods, but have not been able to get a correct solution or been able to resol...

'this' object can't be accessed in private JavaScript functions without a hack?

I was working on a project for a while, trying to figure out what I was doing wrong, when I finally narrowed "the bug" down to the fact that the below code doesn't work as I expected: function Alpha() { this.onion = 'onion'; function Beta() { alert(this.onion); } Beta(); } alpha1 = new Alph...

asual jqueryAddress - double url update

hey guys, I'm using asual's jqueryAddress for history support in a wordpress site where I'm loading content without refreshing the page. when i navigate through the site, for some reason the address is updated twice: siteurl/#about-us siteurl/#/about-us (had to modify the urls above because I don't have enough 'reputation points' t...

Removing a hover effect from a revisited page with back button

I'm working on this website, and have a little thorn in my side. When I click a link in the sticky note on this page, then hit the back button, the link still appears to be hovered-over. What would be the least script-intensive way to prevent the link from thinking it's still being hovered over? The problem appears in Safari, Firefox, a...

Date(dateString) returning invalid date in FF

The page works fine in Chrome, but I have this one minor error in FF and a different problem in IE. Assistance with either of these issues is greatly appreciated. Since ive been stumped in the FF error the longest, I'll start with that one: Here's the code: http://truxmapper.appspot.com/sched.html The date picker selects a date usin...

How bad is it to add other attribute to an element or what other options are there?

I have an element where I'm already using the rel attribute, but I would also like to add another attribute that I'll be using in JavaScript. <a href="/" rel="blah" foo="bar">Link</a> Is it alright to add other attributes? Or is there a better option? ...

Remove full css from div with Jquery

Hello guys. In my css i have * { font-family: "Meiryo UI" , Verdana; font-size:13px; } input, select, textarea { font-size: 12px; border-color: #333; color: #333; border-style: solid; border-width: 1px; } But, i want one DIV without CSS. I tried $('#preview').removeClass() $('#preview').removeAttr("style") $('#preview')....

Array backtracking

Hi, There is an array of numbers, the number on each cell display how many setps does you need to go (left or right), for exmpple int[2]=4 that means that you have to go 4 steps or to int [-2] or to int[6] you have to return true if you went trough all the cell and did not went "out" of the array and false if not. Thanks a lot ...

Script/App that automatically compiles and compresses js files as you save

I'm building a web site and have multiple js files all in one directory. When I save any one of the js files I want a script to run that will compile and compress all files using the google closure compiler jar. Example from Google Closure Compiler README: java -jar compiler.jar --js=in1.js --js=in2.js ... --js_output_file=out.js Is ...

Jumping a week or month in the jQuery UI Datepicker

PetersenDidIt did a great job answering this question. He showed how to use a link to update the jQueryUI Datepicker's selected date by one day. His solution was: $('a#next').click(function () { var $picker = $("#datepicker"); var date=new Date($picker.datepicker('getDate')); date.setDate(date.getDate()+1); $picker.datepicker('setDate'...

Get caret position in textarea (IE)

I want to get the caret position inside text area (Internet Explorer only). I have this: document.activeElement.focus(); var sel2 = document.selection.createRange(); sel2.moveStart('character', -document.activeElement.value.length); var caretPos = sel2.text.length; alert(caretPos); If textarea is one line only I get cor...

What is the difference between a global variables and attributes of the window object?

Hi, I'm a bit confused by JavaScript's window object. For starters, consider the following two declarations: var imglobal = "I'm Global"; window.imglobal = "I'm Global"; As far as I understand it, this would be exactly the same (is it?) It can be accessed as "imglobal" or "window.imglobal" in both cases. I don't understand why, var ...

How to get cookie expiration date / creation date from javascript?

Is it possible to retrieve the creation or expiration date of an existing cookie from javascript? If so how? Thanks, Niro ...

How to calculate date range for week and month in javascript?

Hello there, Can someone guide me on date range in JavaScript ? I want to calculate one week and month date range from current(today's) date i.e if today is 18th july 2010, range for week should be 11/07/2010 - 8/07/2010 and for month it should be 01/07/2010 - 18/07/2010. Thanks for your guidance in advance. ~Bharat ...

Javascript Homework advice

I'm a self learner in javascript,currently I'm still a beginner so I just need some advice from some expert about the exercise given by a javascript book,without referring to the answer because I have the urge to learn,i coded out a simple site request by the question. The question is as follow: Create a user interface that allows the ...

Preloading of html web page or non-flash web applications?

Hi all, I believe that most of you have heard of preloading of images. But is there anyone who knows how we can preload webpages? For instance, when we are login to GMAIL, we will see a loading progress bar. How do we preload html webpages/web applications (non-flash based ) as per what gmail is doing? best Regards ...