javascript

Regular Expression to remove Div tags

Hi, I have a div tag, nested with many span and div tags inside it. now i want a regular expression in javascript which will strip the div and the content inside it. thanks in advance.. ...

CreateLink doesnt work in IE7/IE8 when overlapping text is selected

Hi All, Please refer to this link for a rich text editor It works great in Mozilla. The problem comes in IE. This is the use case. 1) Add Some text 2) Add a link to some portion of the entered text. 3) Now select some more text overlapping the previously selected text and add a link. 4) In mozilla this works fine and the complete ta...

Error handler isn't called when file is uploaded via Ajax using jQuery form plug-in

Here's my test case. If the form is posted, a 500 error response is sent. If not, the form is sent. If the file input tag is commented out, the error handler is called. If the file input tag is present, the error handler isn't called. I think this might have something to do with the fact that jQuery needs to use an iframe to handle the ...

How do I create an array in javascript whose index starts from 1

By default index of every javascript array starts from 0. I want to create an array whose index starts from 1. I know, must be very trivial...thnx for ur help ...

How to detect what allowed character in current Regular Expression by using JavaScript?

In my web application, I create some framework that use to bind model data to control on page. Each model property has some rule like string length, not null and regular expression. Before submit page, framework validate any binded control with defined rules. So, I want to detect what character that is allowed in each regular expression...

Am I using too much jQuery? When am I crossing the line?

Lately I found myself using jQuery and JavaScript a lot, often to do the same things that I did before using CSS. For example, I alternate table rows color or create buttons and links hover effects using JavaScript/jQuery. Is this acceptable? Or should I keep using CSS for these kinds of things? So the real question is: When I'm using ...

Firefox won't change image source

I'm trying to change an image in JavaScript+Prototype by changing the "src" attribute of the element. It works fine in IE, but not in Firefox. I don't get any errors and the script continues executing after this bit executes: var image = $('toggle'); image.setAttribute("src", "../images/icons/icon_minus.gif"); image.setAttribute("alt", ...

Dynamically generated form field loses value when new field is added

Hello! I am generating a dynamic fieldset with javascript. For adding fields, I use the following function (this function actually adds more than one field) //add test function addTest() { var location = document.getElementById('addTestLocation'); var num = document.getElementById('addTestCount'); var newnum = (document.ge...

splitting text with javascript match

for below code var str = "I left the United States with my eyes full of tears! I knew I would miss my American friends very much.All the best to you"; var re = new RegExp("[^\.\?!]*(?:[\.\?!]+|\s$)", "g"); var myArray = str.match(re); and This is what I am getting as a result myArray[0] = "I left the United States with my eyes full ...

using xmlHttpRequest.send() in java script

How to use xmlHttp Request.send()?...... My code in java script is as follows: str_xml+="<xml_to_be_submitted><request_xml><client_id>"+document.frmCallEntryAdd.cboCLIENT.options[document.frmCallEntryAdd.cboCLIENT.selectedIndex].value+"</client_id></request_xml></xml_to_be_submitted>"; var obj_http=new ActiveXObject("Microsoft.XMLHT...

Jquery show preloader for every image?

Hey guys, I've a website with a lot of images: <img class='thumb' src=thumbs/image1.jpg/> <img class='thumb' src=thumbs/image2.jpg/> <img class='thumb' src=thumbs/image3.jpg/> <img class='thumb' src=thumbs/image4.jpg/> I wonder if I can display a loading-div for every single image and when it's loaded the div hides? I'm using jquery f...

Google Maps API v3 - Directions/Paths breaking KML Overlay Infowindows

I'm in the end stages before content filling and then production on the Google Maps project I've been working on. A number of bugs and such have been thwarted, but this latest one has me relatively stumped. The demo map can be viewed here: http://dougglover.com/samples/finalProduct/ Everything works fine until you create a path using ...

How to stop AnythingSlider when Flowplayer clicked

Hi. I'm using the Flowplayer plugin inside the AnythingSlider control. I'd like to stop the slider from moving to the next slide when the user clicks to interact with the Flowplayer. I've tried the following but the slider continues to move to the next slide; the .click() call on the #start-stop item didn't work either. I'd like it to st...

In Safari, using jQuery a Form Input Text Field does not receive focus after alert is displayed. Why?

I have an ASPX web form. I use jQuery to simply my Javascript. I use a Javascript validation script to validate each of the form fields' values. If an error occurs, I popup an alert with an error message. Then I transfer focus to the underlying element. Here are examples I have tried. Using jQuery: var Form_FieldDef = function(name) {...

Hide iframe from main window

I have 2 <iframe> on my main HTML form. These <iframe> are loaded from different external domains. Sometime external server goes offline and user see The page can't be dispayed message on my page. Is there a way to hide these <iframe> when target server is not available? ...

Testing database connection Using Javascript in outbound database connector in Mirth

I have database handle in channelMap (for 1 connection for all messages) and I reuse the connection for all messages. Now, before performing inserts (to a MySQL database), I want to test if the connection still exists. How do I perform this test? ...

How to use danvk re-orderable columns with dynamically created tables?

Hi, I'm trying to implement the danvk draggable table javascript, and while I've been successful using it for tables actually in the html source, when I try to use it with tables I'm creating in javascript code, it isn't applied to those tables. Has anyone had the same issue? Many thanks. ...

asp.net mvc 2 - return JavaScript with View

Hi, using ASP.NET MVC 2 I have a navigation menu inside my Master Page. In the navigation menu, I am trying add a class to the that the current page relates to (i.e., home page will add class="active" to the Home button). I'm trying to consider scalability and the fact that I don't want to change individual pages if the navigation chang...

Help with regex in javascript.

Whatever string is given I have to see if there is exactly one space after and before =, If it is more than one space in either side I have to reduce that to one and if there is none, I have to insert one. How should I do that ? String can contain anything. Thanks ...

How to scroll whole visible page down to an anchor with a smooth effect (Scriptaculous or jQuery)?

Hey community, I want to create an navigation with anchors. By clicking on a navigation link, the whole visible page should scroll down to the clicked anchor. The most important is the following structure of the page. --------------- (Begin visible browser area) NAV1 nav2 nav3 content --------------- (Begin/end visible browser area) ...