javascript

bing search api ajax does not work

Hi guys, I want to use the Bing's search api with javascript. Actually, I want the user to write something and query Bing in order to get just images. so, I tried it using ajax. If I try the url http://api.search.live.net/xml.aspx?Appid=[YOURAPIKEY]&sources=image&query=home directly (with the browser) I do get an xml document. ...

Adding li element only if it not already there?

I am constructing an <li> element like this: var element = $("<li></li>") .html(mHTML) .attr('id', "elemid"); I am trying to add this element to a <ul> element only if it doesn't already exist. Any ideas on how to do this? Am I supposed to use contains() to see if the ul element contain the html and then decide? For instanc...

Unobtrusive Toggling failing in Rails

I've been at this for hours but it just isn't working. I'm trying to get ToggleJS working using Scriptaculous' Effects library. Specifically, the example: http://wiseheartdesign.com/page_attachments/0000/0075/demo.html. I got it working beautifully using a pure html file called new.html. I then converted it to new.html.erb so I can inco...

Resolve URLs for ASP.NET in jQuery?

I would like to use "~/" and resolve on the client site. For example, I would want to do this: <a href="~/page.aspx">website link</a> <img src="~/page.aspx" /> I would have my base URLs in ASP.NET like this: <script type="text/javascript"> var baseUrl = "<%= ResolveUrl("~/") %>"; </script> Would I need a jQuery plugin for ...

Component returned failure code: 0x80600011 [nsIXSLTProcessorObsolete.transformDocument]

So, I'm using the XSLT plugin for JQuery, and here's my code: function AddPlotcardEventHandlers(){ // some code } function reportError(exception){ alert(exception.constructor.name + " Exception: " + ((exception.name) ? exception.name : "[unknown name]") + " - " + exception.message); } function GetPlotcards(){ $("#conten...

Form tips with jquery or other library

This is a form validation for jquery: http://www.position-absolute.com/articles/jquery-form-validator-because-form-validation-is-a-mess/ I need something like that but the tips has to appear when I select the input text form by clicking on it and has to dissapear when I select another input text form. Is there a way to do this with jq...

How turn text links into HTML links at the client side with javascript

In my db I have saved every links in the form: www.example.com or http://www.example.com Is there a way to turn this text links into HTML links at the client side ( e.g. javascript ) with tag and parameter like this ?: <a href="http://www.example.com" rel="nofollow">www.example.com</a> ...

Contenteditable text editor and cursor position

How can I (using jquery or other) insert html at the cursor/caret position of my contenteditable div: <div contenteditable="true">Hello world</div> For example, if the cursor/caret was between "hello" and "world" and the user then clicked a button, eg "insert image", then using javascript, something like <img src=etc etc> would be ins...

Using colon in html tag and handle its element in javascript

Hello, why my "myns:button" don't become red in IE 6 / 7 / 8 unlike in Firefox / Opera / Safari / Chrome ? <html> <head> <script type="text/javascript"> window.onload = function() { var tmp = document.getElementsByTagName('myns:button'); for (i = 0; i < tmp.length; i++) { ...

Django doesn't refresh my request object when reloading the current page.

I have a Django web site which I want ot be viewable in different languages. Until this morning everything was working fine. Here is the deal. I go to my say About Us page and it is in English. Below it there is the change language button and when I press it everything "magically" translates to Bulgarian just the way I want it. On the ot...

What's the role of the parentheses in the following piece of code?

This is the tracking code for Google Analytics: var _gaq = _gaq || []; _gaq.push(["_setAccount", "UA-256257-21"]); _gaq.push(["_trackPageview"]); (function() { var ga = document.createElement("script"); ga.type = "text/javascript"; ga.async = true; ga.src = ("https:" == document.location.protocol ? "https://ssl" : "http://www") + ".goo...

Just seen a factory style object creating in JavaScript (without literals). What else do I need to know?

I have just seen this in code var thisYear = (new Date()).getFullYear(); See it live on JSbin. This is cool, as I've always done something like that in 2 lines, i.e. create the new object instance and assigned it to a variable, then called the method on it. Is this new method fine to use everywhere? Any gotchas? ...

JS and Body(Window) Onload event

I have a problem with onload event. My page have 4 iframes and the function from onload event is called 5 times ( one for body and 4 for iframes ). I want only 1 time ( from main body ). Try with srcElement and target property from windows.event but no result... Is there a way to stop onload when iframes load? Code: <body onload="init(...

Looking for jQuery plugin for rounded corners that supports IE6

Does anyone know a jQuery plugin for creating rounded corners for div elements that supports also IE6 ? I'm interested in a cross browsers solution, and the plugins that I saw so far didn't work well with IE6. Thank you very much ! ...

Using nsIZipWriter or other to compress a string as a string?

I need to be able to take a javascript string, compress it using any fast and available means and get back a binary string/blob. Background: The extension I'm developing needs to send various large content to my server. It does this conveniently by dynamically creating a form, adding fields to the form and posting it. Some of these fi...

Fix internal links in JS

I just created a script which extracts the article out of a webpage via server-side JS. (If your interested: it's used for http://pipes.yahoo.com/fb55/expandr .) I just got a little problem with internal links. Some pages include links like: /subfolder/subpage.html What I would need to do is fixing them and setting there root, like t...

Javascript UI Toolkit

I'm looking for a light-weight UI toolkit written in Javascript (something like Swing) but I'd rather not use ExtJS because I fear that will slow things down tremendously. Are there any small UI toolkits out there that mainly focus on layouts? The problems I face in particular are working with layouts. A lot of toolkits come with differ...

Embeding EasyVideoPlayer Code into Wordpress Theme - Video not showing

I'm attempting to place some embed code into a Premium WordPress Theme. NOTE: I'm not great when it comes to php. The embed code is produced by a video player called EasyVideoPlayer. (Basically it allows me to use Amazon S3 and gives me feedback on when people stop watching the video.) This is the embed code I have: <div id="evp-3f0...

Javascript Back Button - Stop back from closing window

How do I get the "back" button seen in my demo to NOT close the browser window? If this can't be prevented, then at least provide them with a confirmation box alerting them the window is trying to close and ask them if they want to continue. I'm using a javascript back button link and forward button link to control the user's history ...

create a YYYY-MM-DD Daterange in JScript/Javascript.

Hello. I need no generate a full daterange in JScript from a given Startdate to now. Startdate: 2010-03-25 2010-03-26 2010-03-27 ... 2010-05-30 I am very confused with Javascript Date. best would be a function to give a daterange as params and getting an Array of the formatted date back, something like that: range[0] = 2010-03-25 ra...