javascript

Validation in jsp using javascript

' <TD CLASS="input-label" VALIGN="top">A:</TD> out.println(widget_renderer.getEditableField("A")); <TD CLASS="input-label" VALIGN="top">B:</TD> out.println(widget_renderer.getEditableField("B")); I want to make the attribute B field required based on the values entered for attribute field A. Also would liek to validate it ...

Making a dektop SMS app...

Thanks to Stack Overflow and you guys i successfully completed my first project (viz. a website using JSP and servlets). The idea which every put forth to me (as i have very little practical experience in making full fledged projects) was to make an app which i want for myself or i think should exist. I have this idea of making a deskt...

Rewrite a IE Code to a FF Code

This is the code (now is full): HTML: <div id="content" contentEditable="true" onkeyup="highlight(this)">This is some area to type.</div> Javascript: function highlight(elem){ // store cursor position var cursorPos=document.selection.createRange().duplicate(); var clickx = cursorPos.getBoundingClientRect().left; ...

How to make autocomplete posting data to the server with first char only and filter the returned result with jquery

All what I need to make any auto complete jquery plug-in to take the first char in the textbox and return all matched names for example from the server, then after writing the rest of chars I can filter the returned result by jquery not all the time posting the chars to the server and return the result. I am using a plug-in that like th...

How to create a Scrollable Table in Google Chrome

Ok so this is basically about scrollable tables. If I have a table element I can make the content scrollable (with some javascript fun, including accouting for the scroll bar using the width) by making the thead fixed height, and the tbody fixed height, then setting scrolling to auto on the tbody. This works in Firefox, but in google c...

Jquery: Possible to dynamically change source of Autocomplete widget?

Greetings, I am using the official Autocomplete jquery widget and am having troubles dynamically changing a variable (selectType) I'm passing via the query string. The variable would change depending upon which option is selected via a select box. $(function() { var selectType = $('#selectType option:selected').attr("value"); $(...

getelementbyid vs index

In my intranet web app there is a table of items which currently uses the id tag to select the row intended, selection is at a rate of 5-10 selections/sec. The method currently used may cause some inconsistencies time to time due to the async nature and it is very hard to sync it correctly. The question is selection by index (via eq tag...

Javascript list like data structure?

Hello, It seems, if I'm not wrong, that because of the way Javascript handles Objects it is unpractical or inefficient to implement linked lists. I would need a data structure in which I could easily do 2 operations(apart from indexing), appending at the end and removing (popping) an object at a given index. Is using an Array and "rec...

Javascript RegExp Result

If you use the regular expression /(this|a)/ Now if I have: var text = "this is a sentence."; text = text.replace(/(this|a)/gi, "_"); document.write(text); I get the output: _ is _ sentence I am working on a piece of Javascript that does selective styling so what I want to do is add '<span class="className">" + word_in_regex + "</sp...

Cleaning up the HTML generated by JQueryUI?

Can this be done? I'm building a template generator complete with resizable and draggable elements inside a preview window. Problem is, when I go to get the HTML generated, each of the elements have all the JQueryUI classes and divs added, which are not desirable in the final product. I'd like the output HTML to be simple enough that I c...

Store a javascript interval in a jQuery element.data object?

Hi! I'm working on a jQuery plugin (a jQuery UI widget) called Smooth Div Scroll where I need to store references to intervals that are specific to each individual instance of the plugin on the page. If i just write something like this: var myInterval = setInterval(function() { alert("Hi!"); }, 100); ...the variable myInterv...

Open window with specified width & height

Hi, I am developing a safari extension and I need to create a popup once you click on a button, I tried an overlay with an iframe but, the destination redirects the whole page so I am forced to use a popup. "window.open() JavaScript method cannot be used to open a new tab and widow from a global HTML file or an extension bar. Instead, ...

persistent data in php question

OK Ive written this neat javascript 'thing' using jquery and ajax. Its all based on the idea that a div has an attribute that lets you write inside the div. (contenteditable=true). I thought it would be cool to make a chatroom type thing out of it, and holy cow its doing some cool stuff(*), but I have an issue. Using ajax I post to a p...

Associative arrays in Javascript?

Currently, I am creating a 3d array in js using the following: var arr = [["name1", "place1", "data1"], ["name2", "place2", "data2"], ["name3", "place3", "data3"]]; I can access each element using arr[0] or arr[1]. But is there anyways I can access them using a key like this: arr["name1"] should give me the first o...

Jquery: Count node separation in xml

I'm loading an xml document using JavaScript (Jquery $.ajax). I need to be able to count the number of branches (b) separating 2 text nodes (s). E.g. <b n="Archaea"> <s>Archaea</s> <b n="Eubacteria"> <s>Cyanobacteria</s> <s>Spirochaete</s> <b n="Seaweeds"> <s>Red ...

how do I know if the mouse pointer is on the HTML element?

I have a timed event I want to behave differently accordingly to what HTML element the mouse pointer is on. Is there a way, assuming I have the HTML element, to know if the mouse pointer is currently on top of it. I am well aware of the onmouseover/onmouseout events and how to use them. I am using JQuery. I am obviously looking for some ...

Why does IE8 fail to window.open() when viewing local HTML files (and how to fix it)?

Due to orders, I must test some pages from a local file system running Windows XP and IE8. Firefox and other browsers can view the documents and javascript for opening new windows works. However, with IE8, I get new window filled with some default error message, "Internet Explorer cannot display the webpage". Anyhow the first "launche...

Client HTTP Post to external sites

Is there any web language that allows the client itself to create HTTP posts to external sites. I know that JavaScript does this with XMLHttpRequest, but it does not allow cross-domain posting, unless the recipient domain wants to allow the sending domain. I want to post data to an external site (that I don't control) and have the requ...

How to block writing in input text?

Hello! I just creating a booking system and I want that the users will choose a date from the calender and it'll show in input text - that I did! Now I want to block the writing in the input text (just bring to calender writes there when the user choose a date). How do I do it? I guess JavaScript, but how? I dont know JS very wall.. T...

Associative Arrays/Object - getting values with dot notation

Hi, I don't really get why this isn't working: thing = { img78:{ exifmanufacturer:"Canon", exifmodel:"Canon EOS 450D", exifexposuretime:"1/125", exiffstop:"71/10", exifiso:"200"}, img79:{ exifmanufacturer:"Canon", exifmodel:"Canon EOS 550D", exifexposuretime:"1/125", exiffstop:"71/10", exifiso:"100"}, img80:{ exifmanufacturer:"Canon", ...