javascript

Contending with JS "used before defined" and Titanium Developer

I have a lengthy JavaScript file that passes JSLint except for "used before it was defined" errors. I used normal function declarations, as in... function whatever() {do something;} as opposed to... var whatever = function(){do something;}; and consistent with Steve Harrison's reply to an earlier post... Assuming you declare a...

Images with rounded corners

How do sites like these get to display images with rounded corners? I checked with Firebug that the image being downloaded has sharp corners but the image being displayed has been modified somehow. EDIT: I am referring to the rounded thumbnail pictures seen in the "Featured" articles section on the site mentioned. ...

Need assistance with values for calling AddDiscussionBoardItem on WSS for MOSS

I am writing UI for the SharePoint Message Board functionality using Silverlight and communicating via WSS with JavaScript/CAML. I have the retrieval of Discussions and Messages working fine; however, I am having difficulty posting a reply to a Discussion or Message. The AddDiscussionBoardItem method expects the List name and the Messa...

How can I test if two jQuery wrapped DOM elements are the same?

I'm writing a sortable list implementation in jQuery (b/c of the infamous scroll-in-div issue, any new solutions for this?). However, I don't know how to compare the elements (triggered on mousedown/mouseup) after they've been wrapped in jQuery. In prototype, it was always ele.domNode. This is what I'm trying to accomplish in essence......

JQuery - add more than 1 comment doesnt work

By this code I add comments to a posts. But there is a problem - the first comment work, but i am not able to add next. I use livequery, so it shold work. Can you help me? $('form.comment_form').livequery('submit', function a() { var element = $(this); var wall_post_id = element.attr("id"); var wall_messag...

Replace \n with <br> and \r\n with <p> in javascript

Hi All, I need JS that will remove any HTML tags, and then replace newlines with </p><p> and line breaks with <br/>. The string value is coming from a textarea and I understand Linux, Mac and Windows all format newlines differently so I need to take that into account. Thanks! ...

jQuery event handler not working

Hi, i have a form like: <form id='new_key' action='/foo/bar' method='post'> <input type="text" id="u"> <input type="submit" value="submit"> </form> I can bind a jquery event to this element like: <script type="text/javascript"> $('#new_key').ready(function() { alert('Handler for .submit() called.'); return false; }); It works a...

Why does canvas.toDataURL() throw a security exception?

did i not get enough sleep or what?? This throws Error: SECURITY_ERR: DOM Exception 18 and here's my js code... There's no way this shouldn't work!!! var frame=document.getElementById("viewer"); frame.width=100; frame.height=100; var ctx=frame.getContext("2d"); var img=new Image(); img.src="http://www.ansearch.com/images/interface/item/...

How can I make a customized background-image for a <div> in the <head> based on variable passed from URL?

I am trying to allow very primitive customization based on being able to pass a variable through the URL. For example, if they come to my site through the following: http://my.stackexchange.com?c=alpha I would be able to display an image, either as an tag or as a background-image, whatever is feasiable, called image-a.png But if they ...

Is it possible to use js2-mode as javascript mode with nxhtml?

Is it possible to use js2-mode as javascript mode with nxhtml? ...

How should I organize javascript when using CodeIgniter

I'm trying to find a good organization practice of my javascript (jquery) files when using CodeIgniter. I do a lot of ajax sites and many of my views are loaded in various controllers, I'd like to only load the necessary javascript for those views without duplicate code. How do y'all handle this issue? ...

Why were namespaces removed from ECMAScript consideration?

Namespaces were once a consideration for ECMAScript (the old ECMAScript 4) but were taken out. As Brendan Eich says in this message: One of the use-cases for namespaces in ES4 was early binding (use namespace intrinsic), both for performance and for programmer comprehension -- no chance of runtime name binding disagreei...

Calling a code behind method based on a click event

I currently have this working but it requires me to have a static method as the method called in the code behind. I would like to be able to access some member variables that can't be static. I'm not married to the Javascript implementation and am open to other suggestions that would help me achieve this. If there is other information...

Will this JQuery plugin work in the iPhone and Android browsers? (they use webkit)

I want to use this LazyLoad plugin for JQuery. http://www.appelsiini.net/projects/lazyload But, they say this at the bottom of the page: Due to webkit bug #6656 Lazy Loading wont give you any improvements in Safari. It will load all images you wanted it or not. It seems jQuery 1.3.x breaks the plugin for IE. All images ...

issues with sizing of chrome browser window using window.open()

Hi, I'm having issues setting the size of a popup and disabling the location bar in Google Chrome. I'm using the following: window.open( "site.html", "site", "top=50,left=50,width=20,height=50,location=no,menubar=no,scrollbars=no,status=no,toolbar=no,resizable=no" ); Chrome doesn't resize the window to the specified height and width,...

Slider control for volume - JQuery/Javascript

I am looking for a fancy Slider control using JQuery/Javascript. The native JQuery slider is rather bland for this requirement. The slider will be used to specify the volume in the increments of 5. So, this slider should only let user slide in increments of 5. One nice to have feature is to be able to show label above the slider positio...

What is the difference between JavaScript class definitions styles?

I am not clear on the actual difference between these two styles of "class" definitions in JavaScript. Method a: function myclass() {} Method b: myclass = function() {} Is there any difference? ...

Javascript scoping - parents siblings

In the example below I'm trying to access the parents sibling. Is there a better way than what I've come up with, what gives? Broken: var funkyness = function(){ var some_obj = { foo: function() { alert('bar'); }, 'wrapper' : { 'OK': function() { // I want to acces...

How to replace all points in a string in JavaScript

Hi, I want to replace all the occurances of a period '.' in a JavaScript string For example, I have var mystring = 'okay.this.is.a.string'; I want to get -> okay this is a string so far I tried mystring.replace(/./g,' ') but this ends up with all the string replaced to spaces. Any idea how to resolve this? ...

Is there a JQuery plugin for this?

I am currently using YUI datatable, but it is buggy: http://developer.yahoo.com/yui/datatable/ Is there another similar plugin that can do this , in JQuery? ...