javascript

Like-condition in CouchDB

I want to perform a LIKE-condition (SQL syntax) in CouchDB. How can this be done? The LIKE-condition will be used to perform auto complete in the browser. I want to write "co" in the input field and get the results Coffee, Couch, CouchDB ect. ...

Opera javascript

This code function is runing when mouseover in div with interval 10ms It is using framework prototype 1.6.0.2 In all another browsers it works fine but not in opera function openMenu(){ var pleft = $("slidemenubar2").getStyle("left"); if(parseInt(pleft) < 0){ $("slidemenubar2").setStyle({left: (parseInt(pleft)+10)+'...

Is passing values to javascript/JQuery through the id attribute in tags common practice? Is it safe?

I find myself doing this a lot, for specific properties for animation purposes, and specially when I'm generating something using database values obtained through PHP. Is there a reason not to do this. Some sample code, to clear up ambiguity. This would be the JQuery: $('.class').each(function(){ var my_new_width = $(this).attr('i...

Javascript - Cancel onload event

var town_imgs = $('.town_img img'); var container; var imggg town_imgs.hover(function(){ container = $('<div class="town_img_thmb">' +'<span class="thmb_container ajax2"></span>' +'</div>').appendTo($(this).parents('.town_wrapper').find('.thmb_wrapper')); var imggg = new Image...

2D Canvas in Browser

Hi, I'm looking for a framework or library to use the browser as a 2D "drawing" tool. Acctually drawing is not the right word. It should be a adding, removing and moving around of 2D objects and images on a canvas. The objects should be graphically connectable. So - kind a visio in a browser I guess it's a bit to much for a javascrip...

Using Javascript to Open a New Page and Populate Form Values There

I am using JavaScript in a bookmarklet to populate form elements on a website: javascript:var f = document.forms[0]; f.getElementsByTagName('input')[0].value = 'myname'; f.getElementsByTagName('input')[1].value = 'mypassword'; f.getElementsByTagName('input')[2].click This works. However what I would like to create is a bookmarklet so ...

jQuery selector by classname minus classname

I have the following jquery line in a click event of a p element: $(this).nextUntil('.Maintheme not:.Document') I would like to get all the next elements with class .Maintheme but not .Document. To explain myself a little better, this is the html that i have: <div id="DocumentContents"> <p class="Maintheme">ParentTheme1</p> <p clas...

document.execCommand paste not working in contentEditable div

document.execCommand paste not working, i.e it works only when a selection has been made and it replaces the selected contents, otherwise no change is made. By the way I am using a contenteditable div element where I am trying to do this. In all browsers it fails, I am using it on clicking a particular li element of a ul. <ul> <li>...

Javascript: Is there a benefit to using a return statement that returns nothing?

I'm refactoring a large javascript document that I picked up from an open source project. A number of functions use inconsistent return statements. Here's a simple example of what I mean: var func = function(param) { if (!param) { return; } // do stuff return true; } Sometimes the functions return boolean, so...

Javascript: Get all elements with id id[x]

Using javascript how do I get the number of elements present with the id of id[x]? Sample HTML: <input name="vrow[0]" id="vrow[0]" value="0" type="text"/> <input name="vrow[1]" id="vrow[1]" value="0" type="text"/> <input name="vrow[2]" id="vrow[2]" value="0" type="text"/> <input name="vrow[3]" id="vrow[3]" value="0" type="text"/> The...

How to remove default error message from jquery validation plugin

$(document).ready(function () { $("#frm").validate({ errorClass:"invalid", rules: { cname: { required: true,minlength:5 }, cemail: { required: true, email: true } } }); }); I am using above function to validate my html f...

Django template filter - one line

I'm looking for a Django template filter that turns a multi-line construction into one big line. Has anyone implemented it? The reason is - I have a form, {{form.as_p}} creates a multi-line html fragment, I want to create a javascript variable which is an html fragment, but when I do like this: var new_div_text = '{{form.as_p}}'; ...

CSS problem in ie, ff

<style type="text/css"> <!-- * { border: 0; margin: 0; padding: 0; outline: none; } body { background-color: #5e0305; /* font-family: 'Helvetica','Arial';*/ font-family: Arial, Helvetica, sans-serif; font-size: 12px; color: #999; line-height: 16px; } #itrunk, #strunk { /...

How to substitute text into HTML in jQuery?

I have a piece of template HTML that is returned from a Javascript function: function getTemplate() { return '<li id="element_idx_" class="elementChoice">' + ' <a href="#" onclick="_clickScript_" tabindex="27" title="_toolTip_">' + ' <span id="element_idx_title">_elementDisplayText_</span>' + '...

Maintainable Web Widgets

How do you create maintainable web widgets? Right now, I allow my web users to create web widgets via a simple interface, and all the javascript, css, and html needed for that widget gets saved in a database table cell, which is very unmaintainable. Is there are better way of allowing people to create widgets, yet make them maintainabl...

displaying multiple GoogleMap markers on map

Hi I'm trying to display an array of postcodes onto a google map using PHP and using the Symfony Framework (1.0) The main problem I am having, is that there is some text associated with each marker, i.e when you click the marker a popup appears. The main problem is that the text should point to the correct postcode/marker on the map, ...

javascript file upload size validation

Is there any way to check file size before uploading it using javascript. ...

Hidden DIV and id naming structure

Hi all, I have a script that displays one div at a time while hiding the previous shown div. When a button is clicked, the counter variable increases by one and the naming of the div id's are "step1", "step2", "step3", etc. Here is the script: <script language="javascript" type="text/javascript"> var counter = 0; $('html...

Load browser images with javascript event?

I've got a page containing a lot of images, which are initially hidden from view as I'm using tabbed divs (ie. hiding some divs using CSS display:none). Therefore, when then page loads, it takes ages to load all of the images, which looks like the page is slow (as the loading bar on the browser doesn't complete for 10+ seconds). I woul...

Wordpress complex portfolio page

I've hired a Wordpress programmer for coding my site in wordpress. I'm using a year slider on portfolio page where one can sort projects within certain range eg 2004 to 2007, 2005 to 2009 etc. He is using posts to publish project details and earlier suggested to use post date as published date, which isn't entirely true and I wasn't comf...