javascript

Yahoo! Connected TV playback events.

I'm trying to subscribe to onTimeIndexChanged mediaplayer event. It works fine, as long as view that I'm subscribing in stays focused. When I press back button, or widgets button, my view gets blurred and it no longer receives events. Is it possible for this subscription to persist through switching views? Are there widget-wide subscrip...

How to use Jquery to get array of UL LI and input?

I have five ul lists that I am using and each list might have an input in it. Here is an example: <form id="testForm"> <ul id="1"> <li>TEST</li> <li>Gender: <select id="gender" name="gender"> <option value="0">Male</option> <option value="2">Female</option> </select> </l...

JQuery Change Event Loop

Hello all, I have several checkboxes. If a user checks any of them, I have to see if they are allowed to do that, if not, notify them and uncheck it. However, this get me in a loop as it triggers the change again! How can I over come this? $('#step_1, #step_2, #step_3, #step_4').change(function(event) { if(!$('#section_2_active...

javascript: pause setTimeout();

Hi guys, If I have an active timeout running that was set through var t = setTimeout("dosomething()", 5000), Is there anyway to pause and resume it? Is there any way to get the time remaining on the current timeout? or do I have to in a variable, when the timeout is set, store the current time, then we we pause, get the difference bet...

Mootools .get('text') not working as expected

Update: This works in firefox, but does not work on chrome 6, still investigating. I'm taking an internet programming class and learning various javascript frameworks. I'm working on a mootools problem, and the .get('text') method does not appear to be working as expected on responseXML. Here's the responseXML: <?xml version="1.0" en...

jquery/javascript: arrays

Hi, I am a begginer with Javascript/jQuery and I hope someone can help me with the following: I have a simple form (7 questions; 3 radio buttons/answers per question - except for question 5 with 8 possible choices ) and based on the selected answers, when user clicks on 'view-advice' I want to display relevant advices (combination of 3...

Why mixing ExtJS with jQuery/YUI/Prototype/...

ExtJS have "adapter" for working with other javascript libraries. But why? Why not just use Ext Core? UPDATE: I know it was designed for YUI. But why it need an adapter? ExtJs use ExtJs namespace, almost all other framework use $, they should never conflict. jQuery can work with others without any adapter. Why Extjs need it? Is th...

Opening external websites with a top bar containing "return to site" link.

In this thread user named Pekka gave me an advice to open external sites in a new window and provide a "return to site" link which would call "windows.close()" function. The problem is, that I don't know how to do such a "top bar" or something else containing the link on the site I open. Should I open the external site and write to its s...

What is the difference between declaring javascript objects with var vs. with function?

I'm a confused newbie. I read in a tutorial that you create a javascript object like so: function myObject() { this.myProperty = "a string"; this.myMethod = function () { //Method code } } Then I read somewhere else that you create an object like so: var myObject = { myProperty: "a string", myMethod : fun...

XML <--> HTML Form: Generating HTML form to edit XML?

Hey guys, So I'm trying to write a javascript plugin that involves the editing of XML files in a user friendly fashion. The goal is to receive an XML string representing an object, dynamically generate an HTML form to edit the XML values, then save the changes back into the XML string. Granted this function is generic and useful enough...

Variables Variable (Creating variable with the name of another variable)

i want to create a new variable with a variable name, for example: function preloader(imglist) { var imgs = imglist.split("|"); for (i in imgs) { var img_{i} = new Image; //this is the line where i sucked in! img_{i}.src = imgs[i]; //another line where i sucked in! } } preloader("asd.jpg|qwe.jpg|dorama.png...

dojo drag and drop: how to add handler for drop event

I have a simple list like this: <div dojoType="dojo.dnd.Source" id="myList"> <div class="dojoDndItem">item 1</div> <div class="dojoDndItem">item 2</div> <div class="dojoDndItem">item 3</div> </div> And I use the dojo attributes to make the list sortable. It works without any problems, but how do I add a listener to the ev...

Silverlight video player xap or js

Hi, I'm writing Silverlight video player and I search for inpiration so i have found JW Player. But as I know Silverlight apps are inside .xap files and JW Player uses js script to implement SL logic. Could you explain me how it works and why .js not .xap? Thanks in advance. ...

Is it possible to update a xml file using jQuery?

Is it possible to update a xml file using jQuery? Or do i have to use server side scripting to achieve it? Thank You ...

best way in javascript to make console.log calls not cause problems when there's no console?

I'm using firebug and making lots of console.log, .info, .dir calls, etc. When the app runs on a machine with firebug turned off, it can cause errors. What's the best technique to avoid that? This seems to work: // global scope if (typeof(console) == 'undefined') { console = { info : function() {}, dir : function() {...

Strange Javascript Behavior Using Jquery and Delegate()

I have a bit of javascript that I have used successfully on one page, but does not work on another. I copied the block from one file to another, but it does not seem to be attaching the event at all. When I run the copied block from the console in Chrome or Firefox after the page loads, it works fine. All of the javascript before and ...

HTML/Canvas - drawImage performance with another canvas

I'm working on a game and having some performance problems drawing one canvas onto another with drawImage. According to Chrome's Profiler, I'm spending 60% of my time in just this one drawImage call and 10% in the clearRect above it... The source canvas is about 3000x3000 for now (which is pretty small, I'd say) and the destination canv...

javascript event when you hit 'back' onto the page?

What event can i use to run code when a user visits another page then hits back to load my page again? I wrote window.onload = function() { ... and it works when i hit refresh but not forward then back. ...

My jquery slider is not working properly

Hello, I'm pretty new with JQuery, I'm trying to get this script to work. I'm trying to create a rotator on the homepage of a clients website but I can't get it to run! I get no errors, the files are were they're supposed to be, I can't for the life of me figure out what the problem is! Here's a snipped of the code: <script src="http:/...

Find "word" index in paragraph with jQuery (Javascript)

I have a string that represents a paragraph of text. var paragraph = "It is important that the word cold is not partially selected where we search for the word old"; I want to be able to search this paragraph for the index of a "word" and have it do an exact match on a "word". For example, when searching for "old". I should only get...