javascript

How to solve this iGoogle-gadget issue?

I want make an 'iGoogle gadgets' that changes the search box on the igoogle page. Here is my code so far: <script type="text/javascript"> function bing(){ document.getElementById('sfrm').action="http://www.bing.com/search"; } </script> <input type="button" onclick="bing()" value="Search"><br>with Bing. I have tested it briefly with ...

Getting mouse location in canvas

Is there a way to get the location mouse inside a <canvas> tag? I want the location relative to to the upper right corner of the <canvas>, not the entire page. ...

jQuery UI -> handling dynamic content?

Hi, I'm trying to use a dynamic, single dialog that changes based on ajax calls. Is there any elegant way to change the height and width based on the new content? Currently, I have an empty div which is filled, causing problems. Help? ...

Javascript insists it's not defined, it totally is

I'm not used to writing JS, honestly, and to make matters worse I'm working with the Google Maps API which, while well-documented, is a bear. So, I've written a function that allows a users to zoom onto the map from a link. But the interpreter insists my function isn't defined when I call it. The function is "zoomTo" and it appears in th...

Is the IE 7 in Windows Media Center a full featured IE?

I'm getting reports from my website of weird Javascript errors in a piece of code that normally works well, all with the following user agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; WOW64; Trident/4.0; GTB6; SLCC1; .NET CLR 2.0.50727; Media Center PC 5.0; .NET CLR 3.0.30618) Should I assumed that the IE7 in Windows Media Ce...

Playing Audio In Browser

I need quite fast methods for playing sounds/ displaying graphics in a web browser. I came across O3D which does nicely for the 2D graphics aspects but as far as I can tell there is no neat way to play audio from a JavaScript function. My requirements are that multiply sounds be playable simultaneously and also that each sound start to ...

JavaScript, stop additional event listeners

Imagine I have this code: var myFunc1 = function(event) { alert(1); } var myFunc2 = function(event) { alert(2); } element.addEventListener('click', myFunc1); element.addEventListener('click', myFunc2); When the click event is fired myFunc1 is called, then myFunc2. But how do I (if at all possible) stop myFunc2 from being call...

Following a Javascript link when scraping from a remote site using PHP

Given remote page: http://example.com/paged_list.aspx which uses a Javascript function call to display several pages of tabular data: javascript: show_page(1) javascript: show_page(2) and so on. Users click on the page links to display each page, which triggers a reload but with no query string, ie the URI remains the same. In scrap...

jQuery: getting data from the $.getJSON() method

I'm writing a web application and need to initialize some parameters that I'm pulling via the $.getJSON() method. $.getJSON("../config/", function(data) { console.debug(data); } Now since these values will be used globally throughout the script and will not be triggering an event directly (which is the only implementation of $.g...

Advice "upgrading" from jQuery 1.2.6 to YUI 3?

I have a web application that is using both jQuery 1.2.6 and YUI 2.6.0 and I am thinking about upgrading one or both of these libraries. The current versions (as of this question) are jQuery 1.3.2 and YUI 3.0.0 (beta 1). The main reason for jQuery was the selector engine, and the main reason for YUI was components like TreeView and Dat...

How do you enable javascript in a WebView

I have a very simple Mac Cocoa app that just has a Web View that loads an HTML file with some CSS and JavaScript. I have hooked up the app delegate to this method: - (void)applicationDidFinishLaunching:(NSNotification *)aNotification { NSString* filePath = [[NSBundle mainBundle] pathForResource: @"index" ofType: @"html"]; NSURL *ur...

passing arguments as separate parameters in js

In javascript if I have some function I can use the arguments object to look at how many parameters were passed in. Is there a way to call a second function and pass those arguments as if they are just normal separate parameters? something like this: function f() { g(arguments); } function g(a, b, c) { alert(a+b+c); } So in this cas...

(Rails) How do I reference resources from non-restful views...?

Hi All, How do you ensure that your javascript includes get included properly for all files everywhere using a particular layout? Basically I have some non-restful actions that I've added. I haven't added any ROUTES for them, however, using normal text rendering works fine. It's when I start requiring different "swf" and "js" files (...

Iterate over all members of a object within a function of that object

It would be exceedingly handy if I could do this: var MyObject = function(param1, param2, ... paramN) { this.var1 = stuff; this.var2 = moreStuff; . . . this.varN = nStuff; this.validate = function() { for(var current in this) { alert(current); //validate all member...

prototypal inheritance (javascript)

so I'm finally understanding prototype and how to use it. I'm sure that I'm still trying to solve this as a java inheritance problem, so if there is a more prototypal way to go about this let me know. If B inherits A I want B's constructor to first execute A's constructor. This is important for setting up B's local variables. At first I...

Javascript - How to add div class to createElement

Hi folks, How to add class for the ('div'); var new_row = document.createElement( 'div' ); ...

How do I get a JavaScript popup to come without clicking link?

I am using some pre-written JavaScript from polldaddy. They have a JavaScript option which, when you click on the link, the survey pops up as an overlay to my site. However, I would like when people come to the site, the overlay comes up on its own without needing to click on the link. Here is the JavaScript: <script language="javasc...

How to achieve RSS based news roll?

I want to make the titles of WordPress blog posts appear on a seperate homepage like they do at Apple.com next to "Hot News Headlines". Here is the related source I found but I am unsure how to apply it to my own site: <link rel="alternate" type="application/rss+xml" title="RSS" href="http://images.apple.com/main/rss/hotnews/hotnews.rs...

applying methods to object and private variables in javascript

hello, I am trying to apply a method to an existing object which involves using its private variables. The object is setup like so: function a(given_id) { var id= given_id; } now I want to apply some new method to it like so my_obj = new a('some_id'); my_obj.myMethod = function(){ alert(id); } now if I go my_obj.myMethod() ...

Desperate image positioning problem

What I want is this: http://www.freeimagehosting.net/image.php?11b1fcb689.png Edit: Added a fuller picture of what I'm trying to do. I can make it look right using absolute positioning, but when the window size is too small, the content slides off the page without a horizontal scrollbar. That's why I want to use relative positioning f...