javascript

how do i find the length of options in a combo box

hi guys How can i know is there any options in a combobox/selectbox or not? small Edit: i have my comboxbox as myCombo = $("#country"); now i want to know how many options are there in myCombo ...

How to show/hide a MarkerCluster in google maps v3?

I need to have different markers for different mapTypes, and I'm pushing them to a MarkerClusterer. I "hide" the markers with: cluster.set("map", null); cluster.resetViewport(); cluster.redraw(); And "show" them with: cluster.set("map", MAP); cluster.resetViewport(); cluster.redraw(); The problem is that MarkerClusterer seems to n...

Javascript/Chrome extension how to run function?

Hi I try to make a extension for Google Chrome. But i have a problem. I can't get functions in the js file to run. I tried to put a "alert('Hello World') inside the js file and it worked. But how do i start a function? Have been searching and looking into the documents but i can't find anything. This is the javascript i try to run on...

jQuery RegEx Problems

Possible Duplicate: jQuery find/replace without changing original text I have the following RegEx but I am getting a JS error RegEx: $("#construct_version").html( new RegExp("(" + selection + ")", "g"), $("$1").wrap(childElements[child])); JS Error: Uncaught Syntax error, unrecognized expression: $1 This questions ...

how to fix my onclick problem in a tab content

i have tried what the first person ask me to do it work but there was a problem the submit button did not send to the $_POST['submit'] whether it because of the false in my button(<input type="submit" name="submit" value="Submit" onClick="show_content('div_2'); return false;"/>)i fall i mention that in tab2 content i have a php code that...

showing context menu in contentEditable div

I have a contentEditable div with following text for example: <div contentEditable='true'> This document is classified</div> Now for example if user clicks on 'm' in word document I want to show a context menu containing few text choices. That context menu will be contained in a div element. I want to replace the word "document" with ...

Parsing SQL CREATE TABLE statement using jQuery?

I am writing a web app which uses SQL as input. This SQL must always be a CREATE TABLE statement, and what my app needs to do is getting the following attributes from it: Field name Type Length (if available) Binary (if available) Allow NULL (if available) Auto increment (if available) Example SQL: CREATE TABLE customer (First_Name ...

Load Google Chart API asynchronously

Is there a possibility to load Google Chart API asynchronously like Google Maps API? I've tried out two different things: $.getJSON('http://www.google.com/jsapi'); and $.getScript('http://www.google.com/jsapi'); both are not working. Any suggestions? ...

How do you make a <textarea> recognize that pushing the enter button is a \n character?

I have a <textarea> that I want to print the contents on the page below it. When it does this I want to make random words be omitted. I have accomplished this. My problem is I want make it recognize when the enter button has been pushed in the <textarea> and display that below. I want those to not ever be omitted. I have gotten it so th...

ajax POST not working, can't figure why

I have a simple AJAX function to send an id of an object to a php page My function looks like this: $(function(){ $("a.vote").click(function(){ //get the id the_id = $(this).attr('id'); alert(the_id); //ajax post $.ajax({ type: "POST", data: "?id="+the_id, ...

Event to detect change of an HTML5 number control in Webkit/Chrome?

HTML5 gives us some new input elements to play with, such as <input type=number>. This renders (in Chrome) as a textbox with two cycle buttons inside the textbox, for incrementing and decrementing the numeric value inside the box. For a personal hobby project, I'm using this control. However, I'm stuck with one issue: Is there a way to...

Load models via bin files in webgl?

I see an example where the data was in text inside an array, i seen another where someone loads the model through ajax with json. Is there a way to load the files via binary? i dont feel like loading a 1mb model via 4mb json ...

Is there a way to lengthen a <textarea> by one row every time the user types in the next row with javascript?

I have a <textarea> that I want to grow by one row every time the user enters into the last row shown in the <textarea>. Is this possible? I have seen it done before, but can't figure out how to do it. ...

How can I design a javascript API that allows for cross-domain scripting securely?

I like the way Google Maps' api is consumed, using a script include, but I'm worried: My api is "semi-private", that is, accessible over the internet but should allow for secure transmission of data and some kind of authentication. The data should remain private over the wire, and one consumer shouldn't be able to get at another's data....

Output each combination of an array of numbers with javascript

I have several numbers in an array var numArr = [1, 3, 5, 9]; I want to cycle through that array and multiply every unique 3 number combination as follows: 1 * 3 * 5 = 1 * 3 * 9 = 1 * 5 * 9 = 3 * 5 * 9 = Then return an array of all the calculations var ansArr = [15,27,45,135]; Anyone have an elegant solution? Thanks in advanc...

javascript - predict/estimate next number from a dataset

Hello, Math isn't really my thing, but what I'm trying to figure out is how to predict/estimate the next number from a dataset. Let's say I have an array: var values = new Array(1,4,3,5,6,10,4,15); Does anyone know a formula in javascript that could guess the next number after 15 based off the previous values in the array. Basicall...

Variable keeps changing after function is assigned to event handler

Dear StackOverflow: I have thoroughly researched this question and can't find a solution. Any help would be greatly appreciated. I have a bunch of elements on a page, all of whose ID's are stored in an array called ids[]. I have initialized a third-party DOM script for each of these divs that detects when the element has been dragge...

updating countdown timers

I'm starting to build a script for a Penny Auction site like swoopo.com What framework should I use? Whats the best way to keep the timers updated without using too much bandwidth? This all started when I started looking at all the junk thats currently out there. Most are using PHP and javascript and I feel there is a much better solut...

Is this the correct way to check with javascript if a radio button is checked?

I have the below code but it is not working. Is this correct? var diffLvl = document.getELementById('lvlDiff'); var interLvl = document.getElementById('lvlInter'); var simpLvl = document.getElementById('lvlSimple'); if (simpLvl.checked) { //do stuff } else if (interLvl.checked){ //do stuff } else { //do stuff } ...

Javascript - Load an image onclick

OK, I'm actually calling some java middleware that returns a captcha image. The captcha image loads in the page on page load simply with: <a href="#" id="ci"><img id="stickyImg" src="stickyImg" /></a> I want to reload the captcha image onclick of the current captcha image. I've tried a few things but am not getting anything working. ...