javascript

Javascript - Bypass new element in script

Hello. I have a group of tabs that change the main panel when clicked on. In order to change a particular color property, I need to insert an additional div into my HTML. However, when I do so, it cause an error in the javascript. I'm not a javascript expert, but I think the reason is that the script is calling for an element in a parti...

jQueryUI autocomplete not working

I was using this code earlier today and it worked fine, then I apparantly changed something and it doesnt work. ive tried reinstalling jQueryUI but it doesnt help. <script type="text/javascript"> $(function() { function loadpage(webpage) { window.location.replace( webpage ); } $("#searchform").autocomplete({ ...

How can I detect an iPhone *4* user through javascript

There are lots of scripts for detecting the User Agent string to detect iPhones and other mobile devices, but strangely enough, the iPhone 4's UA is the same as other versions. My webapp has many HTML5 features that need to be displayed differently for the 326ppi screen than other resolutions. Thanks in advance for any insight. ...

anonymous function, add parameters

I use in my Ajax.Request my jsp. (Prototype) Somehow I can pass extra parameters in the anonymous function onComplete? For example, function save() { var pars = "param1=date"; new Ajax.Request('algo.ctr', { parameters: pars, onComplete: f, }); } var f = function (e) { alert(e.status); } I want to use ...

Regex replaces everything that matches any character

a[b].innerHTML=a[b].innerHTML.replace(RegExp('['+bbc[c][0]+']','ig'),bbc[c][1]) This is basically what I'm working with. It's wrapped in two loops so that should explain why it looks like what it does. Basically I want to replace something that matches '['+variable from an array+']'. I'm making a BBCode script for a free forum and no d...

Pre-loaded Local Database Backend for Javascript (Possible?)

Hello: I have recently seen articles on HTML5 and local Db creation and usage. I have also seen some examples of Javascript connection strings to existing Access Db backends. I am interested in finding a way to build a Db, pre-load it with records, and use a web app to connect and read the Db. For example, I have created many standal...

European language/french stemmer in Javascript

Hello, I am in need of a stemmers written in Javascript for european languages. I'm currently looking for a french stemmer, but if there's stemmer for any other language, please let me know. There are stemmers available in Java, but not for javascript! Here are the Java implementations: http://snowball.tartarus.org/ You can download al...

jquery-ui sortable connected lists with hidden overflow

I have two fixed hight divs each containing a sortable list which are connected to each other. Is there a way to hide the overflow while still having the lists connected? E.g. if the overflow is set to hidden then the li doesn't show when it is dragged outside of the div. I know a possible solution would be to calculate the maximum numb...

Non-terminating RegExp.exec in Rhino

I have the following JavaScript program saved in a file pre.js: var pre = readFile("method-help.html"); RegExp.multiline = true; print(/<pre>((?:.|\s)+)<\/pre>/.exec(pre)[1]); The contents of method-help.html is simply the page at http://api.stackoverflow.com/1.0/help/method?method=answers/%7bid%7d. What I'm trying to do is get the J...

how to change the text of a textarea when a dropdown list is selected

how to change the text of a textarea when a dropdown list is selected. Here is my code... <html> <head> <script type="text/javascript"> function fifa() { abc=document.forms[0].browsers.value; if(abc==""); document.form1.text1value="you selected A"; else if document.form1.text1.value="you selected B"; else document.form1.text1.value="you...

JavaScript loops to store data in an array

I have a friend who has an assignment on arrays and because I lack experience in Javascript and she just needs some real quick help understanding how to implement a Javascript loop to store data in an array which converts a letter grade to a number. Can someone just guide her in a general direction? https://docs.google.com/fileview?id=...

Detect when user selects text in a textarea

How to detect when user selects text in a textarea with JS? I used jQuery-fieldselection ,but it works only if the range.text is putted into a pre tag.It doesn't work with div. ...

How to print \n in a <textarea> using JavaScript?

Ex : document.write("\n"); I want to print that \n in my <textarea>. ...

Client Path of uploaded file or image?

Here is what I am trying to make. Whenever a user browses a image from a file field. I want to grab the clients path and show it on the page so that user can be certain of what image he choosed, before uploading it. ...

is it possible to change the extension of a cookie file using javascript ??

is it possible to change the extension of a cookie file using javascript ??? ...

JavaScript: Global variables after Ajax requests

the question is fairly simple and technical: var it_works = false; $.post("some_file.php", '', function(data) { it_works = true; }); alert(it_works); # false (yes, that 'alert' has to be here and not inside $.post itself) What I want to achieve is: alert(it_works); # true Is there a way to do that? If not can $.post() retu...

formatting javascript to be echoed out by php

I am trying to echo out some JavaScript, but I can't get the formatting right I start off by putting the javascript I want to out into a string $javascript = 'onmouseover="this.style.backgroundColor='blue'" onmouseout="this.style.backgroundColor='white'"'; and then echo it out like this $hint="<span $javascript>".$artistname->item...

Remove all JavaScript event listeners of an element and its children?

Hi, Is it possible to remove all event listeners of an element and its children? Something like: myElem.removeEventListeners(); I need this because I have a complex element with events, and I need to create a copy of it -- like a static image that does not react to any events. ...

Google Maps API problem when drawing polygon

Hello, So, when i draw a polygone with Google maps API the weirdest thing happens: on every click, I update a textarea with the position of the current set point and when i, let's say, draw a fullshape, but want to click inside it, the whole shape dissapears and it doesn't see that point I clicked as a google coordinate, causing a fatal...

How do I make this anonymous Javascript function reference the right variable?

Example: var o = {}; for(var i = 0; i < 5; i++) { o[i] = function () { console.log(i); }; } o[3](); When I call o3, it will always display 5 on the console, even if I call o0, o4, or any one of those. It will always display 5 because that's the last value i had. How do I make it display the value of i when the anonymous fun...