javascript

Break from frames based on parent's URL

I am trying to help a friend of mine break his site out of some nasty frames: example. This wouldn't normally be an issue but this particular site crosses some ethical boundaries by placing an advertisement on the top of the page that is NOT paying my friend. Here is where it gets complicated, he would like his site to be in frames for...

ExecWB Print Preview Sometimes shows blank pages.

Hello.. This is a weird one. I am using the ExecWB method to create a PrintPreview window. Most of the time the print preview appears correctly. But sometimes it shows a blank page and that is all. Has anyone seen this before? The problem appears to be isolated to IE6. The problem is very hit and miss so it is difficult to determine wha...

creating a new, empty document with javascript

I'm working with some very unintuitive xml (all the tags are things like "TX", "H", "VC"). I'd like to make a copy of this data, but with all of the tags renamed to what they actually mean. Can I create a new, empty document to put my new, nicely named tags in to? I've tried this: doc = (new DOMParser()).parseFromString("", 'text/xm...

JQuery submitted values for checkboxes are undefined

I just received some really great help today with a prior jQuery problem and figured since my luck was running that maybe I could also get some help with some checkboxes. Can someone please tell me what I am doing wrong? Thanks! The checkboxes are correctly echoing the database bool values but when I submit the changed values, an alert...

Prevent text selection after double click

I'm handling the dblclick event on a span in my web app. A side-effect is that the double click selects text on the page. How can I prevent this selection from happening? ...

How to load .js files into a Rhino context in Java

Here is my situation: I have access to a Rhino Context object in a Java class. I want to read in a bunch of .js files and pass them along to the Rhino context to have them evaluated. I'm not really interested in having the functions in the .js files available in the scripting context so much as I am in just having the variables that a...

Prevent click event from firing when dblclick event fires

I'm handling both the click and dblclick event on a DOM element. Each one carries out a different command, but I find that when double clicking on the element, in addition to firing the double click event, the click event is also fired twice. What is the best approach for preventing this behavior? ...

Best Practice for Naming the Id Attribute of Dom Elements

This is related to naming conventions for a DOM element's id attribute and I guess the name attribute as well. When it comes to JavaScript, from what I understand and have done is always use camel case except for the names of classes. Classes are Pascal cased. Having said that I develop in ASP.NET mainly and here's where I run into a na...

JQuery table w/ sorting

There are all kinds of JQuery widgets that offer some nice features like sorting by a columns (like http://tablesorter.com/docs/ or http://www.datatables.net/) I haven't found one that integrates with server side sorting though. I have the following requirements: sort by clicked column (server side sort) filter by a text field over e...

ASP.NET Setting a DetailsView BoundField value from javascript

Hi, I'd like to know if it is possible to set a field of a DetailsView BoundField (in edit mode) from javascript? I can't set an id for the boundfield, so obviously can't use document.getElementById() to get to it, but I was wondering if there's another way to do it? ...

Count the number of occurances of a character in a string in Javascript

Hi, Firstly, I am new to Javascript. I need to count the number occurances of a character in a string. Its something like suppose my string contains var mainStr = "str1,str2,str3,str4"; My return value should be 3 I also need to validate that each of the strs i.e str1 or str2 or str3 or str4 should not exceed say 15 character. Ca...

Determining height of embedded html object

Hi! Two questions ... I want to use the object tag to embed an html file that uses external style sheets ... however, nothing that I have tried works. The first question is how to that? ... note: the style sheets are linked to both documents. The second question is how to determine and set the height attribute of the object so as to e...

processing.js loading external files

I want to split my processing.js code into several files but I'm not sure how. I tried doing <script type="application/processing" src="main.pjs"> to load my processing.js file "main.pjs" but it didn't work. ...

jQuery - checkboxes like radiobuttons

I have group checkboxes and I like if this group have behaviour like radiobuttons with same name atribute. Each checkbox has different name. Only one can be chosen from checkboxes. How I can do this? Solution Why I need this? Because we need consistency webUI. Please, this is not question about our application architecture. :) HT...

:hover with a nested sIFR element

I've got the following html: <li><a href="#"><span class="font Berthold-light">1</span>Consectetur adipiscing elit risus.</a></li> The number within the span is replaced by sIFR, but I'd like it to change color on a:hover. In CSS it would work like this: a:hover span { color: #0fb5ef; } Is there a way to do the same with sIFR? ...

Javascript Namespace Declaration

What neat ways do you use for declaring JavaScript namespaces. I've come across this one: if (Foo == null || typeof(Foo) != "object") { var Foo = new Object();} Is there a more elegant or succinct way of doing this? Just a bit of fun... ...

Modifying Liferay javascript functionality

I want some tags to be added to an article. The problem is that the tags are displayed in the pop-up window in "random" order. This is due to order they are pushed to the page. I want to intervene, sort the tags and present them ordered. How would you do that? I spotted the methods in tags_entries_selector.js, but I am not really sure wh...

ASP.NET AJAX Function.createDelegate vs Function.createCallback?

Hi, i'm reading the book manning - asp.net ajax in action. on page 54-58 client delegates and callbacks are described. in short: with the client delegate you can change the this variable in the event handler itself to reflect another object. (so it won't be the DOM object that triggered the event for DOM events) with a callback you c...

Trouble accessing Java classes from Firefox extension's Javascript

I'm going to develop a Firefox extension which uses some Java classes. The extension gets the value of <input type="file"> fields, using Javascript. The Java class I'm going to create is the following: public class Firefox { public static String inFileName; public static void main(String[] args) throws IOException { in...

Multi-page AJAX form with conditional subsections

I would like to go about creating a multi-page form that changes based on options that are selected on previous pages of the form. I want to use Zend_Form, and I know JavaScript will be in charge of making the different form fields appear/disappear, but I don't know how the two will work together exactly. My question is how to get star...