javascript

tagName is null or not an object -- error msg in IE7 using latest version of jQuery (1.2.6)

has anyone else seen this error message. a quick check with google doesn't show me much. ...

How do I display a date/time in the user's locale format and time offset?

I want the server to always serve dates in UTC in the html, and have javascript on the client site convert it to the user's local timezone. Bonus if I can output in the user's locale date format. ...

A sample for jQuery based WYSIWYG Editor demonstrate OOP javascript

Want a WYSIWYG jQuery Editor as an example to illustrate how to use jQuery to built OOP javascript component. P.S. It is so good stackoverflow can use markdown... Would be a heaven if users would love such thing too ...

How to tell if a Javascript function is defined

How do you tell if a function in Javascript is defined? I want to do something like function something_cool(text, callback){ alert(text); if( callback != null ){ callback(); }; } but that gets me a 'callback is not a function' error when callback is not defined. ...

How can I reimplement external pop-up jQuery code in Prototype?

I have this code in jQuery, that I want to reimplement with the prototype library. // make external links open in popups // this will apply a window.open() behaviour to all anchor links // the not() functions filter iteratively filter out http://www.foo.com // and http://foo.com so they don't trigger off the pop-ups jQuery("a[href='ht...

How do I enumerate the properties of a javascript object?

I actually want to list all the defined variables and their values, but I've learned that defining a variable actually creates a property of the window object. ...

How can I supress the browser's authentication dialog?

My web application has a login page that submits authentication credentials via an AJAX call. If the user enters the correct username and password, everything is fine, but if not, the following happens: The web server determines that although the request included a well-formed Authorization header, the credentials in the header do not ...

Why is setInterval calling a function with random arguments?

So, I am seeing a curious problem. If I have a function // counter wraps around to beginning eventually, omitted for clarity. var counter; cycleCharts(chartId) { // chartId should be undefined when called from setInterval console.log('chartId: ' + chartId); if(typeof chartId == 'undefined' || chartId < 0) { next = c...

Why require JavaScript rather than supporting a standard browser virtual machine?

Would it not make sense to support a set of languages (Java, Python, Ruby, etc.) by way of a standardized virtual machine hosted in the browser rather than requiring the use of a specialized language -- really, a specialized paradigm -- for client scripting only? I understand the pragmatic issue that JavaScript is simply what we have to...

What's the best way to reload a iframe using javascript?

I would like to reload an iframe using javascript. The best way I found until now was set the iframe src attibute to itself, but isn't pretty. Any ideas? ...

Does C# have an equivalent to JavaScript's encodeURIComponent()?

In JavaScript: encodeURIComponent("©√") == "%C2%A9%E2%88%9A" Is there an equivalent for C# applications? For escaping HTML characters I used: txtOut.Text = Regex.Replace(txtIn.Text, @"[\u0080-\uFFFF]", m => @"&#" + ((int)m.Value[0]).ToString() + ";"); But I'm not sure how to convert the match to the correct hexadecimal format t...

How do I use RegisterClientScriptBlock to register JavaScript?

ASP.NET 2.0 provides the ClientScript.RegisterClientScriptBlock() method for registering JavaScript in an ASP.NET Page. The issue I'm having is passing the script when it's located in another directory. Specifically, the following syntax does not work: ClientScript.RegisterClientScriptBlock(this.GetType(), "scriptName", "../dir/subdir...

Why is using Javascript eval function a bad idea?

The eval function is a powerful and easy way to dynamically generate code so what are the caveats? ...

Is there a JavaScript PNG fix for IE6 that allows CSS background positioning?

I've seen a few fixes for allowing PNG images to have transparency in Internet Explorer 6, but I've yet to find one that also allows you to set the background position in CSS. If you use sprites, it's a deal-breaker. I've resorted to using GIF's (which are not as high quality), not using transparent images at all, or serving a completely...

Google Maps, Z Index and Drop Down Javascript menus

I've run on a little problem today: I have a JS drop down menu and when I inserted a GoogleMap... the Menu is rendered behind the Google Map... Any ideas on how to chance the z Index of the Google Map? Thanks! ...

Javascript array reference

If I have the following: {"hdrs": ["Make","Model","Year"], "data" : [ {"Make":"Honda","Model":"Accord","Year":"2008"} {"Make":"Toyota","Model":"Corolla","Year":"2008"} {"Make":"Honda","Model":"Pilot","Year":"2008"}] } And I have a "hdrs" name (i.e. "Make"), how can I reference the "data" array instances? seems like data["Ma...

Opening Javascript based popup ads on the same page.

I own an image hosting site and would like to generate one popup per visitor per day. The easiest way for me to do this was to write a php script that called subdomains, like ads1.sitename.com ads2.sitename.com unfortunatly most of my advertisers want to give me a block of javascript code to use rather than a direct link, so I can't ju...

Can I pass a JavaScript variable to another browser window?

I have a page which spawns a popup browser window. I have a JavaScript variable in the parent browser window and I would like to pass it to the popped-up browser window. Is there a way to do this? I know this can be done across frames in the same browser window but I'm not sure if it can be done across browser windows. ...

javascript library to show photo album

I visited few web sites in the past where they had a set of photo thumbnails and clicking on one of them created a cool effect of an expanding popup showing the full size image. Is there any available free javascript library that will do this? I'm interested mostly in the popup effect and less in the rest of the album management. ...

How to enter Javascript into a wiki page?

How can I, as the wiki admin, enter scripting (Javascript) into a Sharepoint wiki page? I would like to enter a title and, when clicking on that, having displayed under it a small explanation. I usually have done that with javascript, any other idea? ...