javascript

Finding index inside a Javascript regular expression match.

i had string like this in javascript var str = "This is my test string is Ingrédients"; the substring "Ingrédients" can be also as "Ingredients" how to get the index of substring "Ingrédients" from the above string by applying regular expression ( Ingr[ée]dients ) ...

Syntax error. Help with one small JS snippet :(

Hey guys. I don't know much JS, but I wanted to do some quick work with jQuery. But I've been staring at this for about an hour and I don't understand what I missed: <script type="text/javascript"> $('#qty_6035').change(function () { var substractedQty, stockQty, remQty; substractedQty = (int) $('#qty_6035').val(); ...

Image upload and jCrop and codeigniter

Hi There, I am trying to build a system that allows a user to select an image from their own computer, and crop it using the jCrop tool from jQuery. My question is can I show the image the user has selected from their system without uploading it to a system, I dont really want to do two uploads, unless I can do the first upload silent...

Using jQuery to Highlight (Select) All Text in a Textbox

I have an input text box with some text in it , onclick event I want to run a javascript function to select (highlight) all text that is in this box , how I can do that with jquery? ...

javascript adding javascript to iframe dynamically

The code below will add an iframe dynamically, is there a way to insert javascript to this iframe dynamically? Thx var iFrame = document.createElement('iframe'); var iFrameSRC = "http://www.google.com"; iFrame.name = 'hehe'; iFrame.id = 'hehe'; iFrame.src = iFrameSRC; iFrame.width = '1px'; iFrame.height = '1px'; iFrame....

MooTools request fails

Hi everyone, I am trying to achieve this task using MooTools. Description: I have three buttons. Two buttons outside myDiv and one button inside myDiv. A click on any of these buttons initiates an AJAX request (passing button variable to "button.php") and updates myDiv content based on the response text. So, after update, myDiv shows B...

Why NOT use POST method here?

I have a classifieds website. In the main page (index) I have several form fields which the user may or may not fill in, in order to specify a detailed search of classifieds. Ex: Category: Cars Price from: 3000 Price to: 10000 Color: Red Area: California The forms' action is set to a php page: <form action='quer...

Colour manipulation of custom tags in niceEdit HTML editor ( JS / DOM )

Hi, I would like to be able to highlight, during typing and in real time, certain custom tags in the format #tag_name# within the text of a nicEdit instance ( http://nicedit.com/ ). My current attempt to implement as close to this as possible revolves around using the blur event of the editor to highlight the tags once the editor loses...

Backslash in JavaScript

In my javascript code I have onchange="document.getElementById('user_name').value = document.getElementById('theDomain').value + '\\' + document.getElementById('fake_user_name').value" here backslash doesn't work. What is the problem? How should I write it? example: I want to have "x.com\joe" by using domain name(x) and fakeuser...

Opening a New Window in a New Session with Javascript in Internet Explorer 8

Hi We are migrating at work to Internet Explorer 8 and we are confronted to the new "feature" the so called "Session Merging", all new windows from IE8 share the same Session Cookie. That's creating some problems because we have a Web based system that must permit work in parallel in several windows, but each must have it's own Sessio...

Convert a Javascript Date format to desired PHP format

How can we convert Wed Jun 09 2010 which is returns from a javascript function and get in a php script.I need to convert this date format to 2010-06-09.Thanks ...

Scoping problem with Javascript callback

I am having some trouble getting a callback function to work. Here is my code: SomeObject.prototype.refreshData = function() { var read_obj = new SomeAjaxCall("read_some_data", { }, this.readSuccess, this.readFail); } SomeObject.prototype.readSuccess = function(response) { this.data = response; this.someList = []; for (v...

Can't find asp:textbox in Javascript.

I am trying to add the onkeydown attribute to an asp:textbox. For some reason my code can't find the textbox that is inside a loginview. Am I doing something wrong? <script type="text/javascript"> window.onload = function() { UserName.Attributes.Add("onKeyDown", "KeyDownHandler('" + btn.ClientID + "')"); Password.Attributes.Add...

Retrieving values from a table in HTML using jQuery?

Hi i was just wondering whats the best way to retrieve the current values from this HTMl code using jquery and storing them in to a array? <table id="metric_summary"> <tbody> <tr class="editable_metrics"> <td><label>DataSet:</label></td> <td><input name="DataSet" value="prod"></td> </tr> <tr class="ed...

Regex, replace path to resource, modify resource name

Hi all, I'd like to use a JS regex to take a string such as the following: 'http://www.somedomain.com/some_directory/some_other_directory/some_image.jpg' And turn it into this: 'http://www.some_other_domain.com/another_directory/yet_another_directory/size1_some_image.jpg' Any hints? Additionally, any pointers for books or other re...

highlite text parts with jquery, best practice

Hey guys, i have a list of items containig names. then i have a eventlistener, which ckecks for keypress event. if the user types i.g. an A all names starting with an A should be viewed with the A bold. so all starting As should be bold. what is the best way using jquery to highlite only a part of a string? thanks for your help ...

navigator.notification.* fails "navigator.notification [undefined] is not an object"

Any call to a PhoneGap navigator.notification method is failing with the message "Result of expression navigator.notification [undefined] is not an object" I've gone through the full installation and project generation process outlined here: http://phonegap.pbworks.com/Getting-started-with-Android-PhoneGap-in-Eclipse ...and the applica...

append versionnumber to asp:ScriptManager's compositescript tag

Hi, we are trying to get the following scenario working: we use asp:scriptmanager / CompositeScripts to combine our scripts into a few script blocks but after each deploy to the test system we have trouble with testers not getting updated versions of css and javascript (browser cache). For the CSS we have defined our own css user contr...

Drag-n-Drop on contentEditable elements

There are numerous WYSIWYG editors available on the internet, but I'm yet to find one that implements some form of drag-n-drop implementation. It is easy to create one's own editor, but I want to the user to be able to drag elements (ie. tokens) from outside the editable area and have them drop it at a location of their choice inside th...

how i can view array structure in javascript with alert()

how i can view array structure in javascript with alert() ...