javascript

Intelligent Merge of two Arrays (3-way-kindof)

I have two Arrays, each represents a list of Stories. Two users can concurrently modify the order, add or remove Stories, and I want those changes merged. An example should make this clearer Original 1,2,3,4,5 UserA (mine) 3,1,2,4,5 (moved story 3 to start) UserB (theirs) 1,2,3,5,4 (moved story 5 forward) The result of the ab...

Web development tool that can comprehend the concept of more than one language in a file at once

I currently use notepad++ on windows or gedit on ubuntu. Both of them work great with code highlighting and hinting etc. But both of them suffer from a huge flaw. I am yet to find a code editor that can handle this concept: <?php // ooh, look I am doing some php ?><a onclick="alert('hay, some javascript in here now!')"> This link is HTM...

How to open an html file using the default file handler and to give the window a name (i.e. target)?

I am writing a warm-up script for a SharePoint server. The idea is to call stsadm and then open an html file containing iframes which touch all the key web pages in my portal. So far so good. The problem is that each time the script is run, a new browser window is opened and I end up with a screen full of browsers. The first idea was t...

Jquery help needed- infinite loop?

Hi all, i have a problem with this code: var par = []; $('a[name]').each(function() { if (($(this).attr('name')).indexOf("searchword") == -1) { par.push($(this).attr('name')); $('.content').empty(); for (var i = 0; i < par.length; i++) { $(".content").append('<a id="par...

Javascript plugin creation

How to create a pure JavaScript(without using any library) plugin which looks like: document.getElementById('id').myPlugin(); like jquery ? ...

How do I make this loop all children recursively?

I have the following: for (var i = 0; i < children.length; i++){ if(hasClass(children[i], "lbExclude")){ children[i].parentNode.removeChild(children[i]); } }; I would like it to loop through all children's children, etc (not just the top level). I found this line, which seems to do that: for(var m = n.firstChild; m != nu...

FancyUpload with JQuery

How to use FancyUpload in a JQuery based project? The page in which I will use FancyUpload is made of JQuery. How to use FancyUpload? Please mention every steps in details. Please ...

Value is not changing in the javascript variable on the onClick event

I am trying to implement a dynamic search jquery and php, but I am not able to change the value of a javascript variable on my onclick event. <script type="text/javascript"> var main_category = '<?php echo $main_category?>'; var main_url = '<?php echo $url?>get/' + encodeURIComponent(main_category) + '/'; var container_id = '<?php...

set cursor position in textarea at end once user clicked on textarea

Hi, I am working on text area using jquery, to provide good UI validation. Currently I stuck at - Once user click in text area I want to set cursor position forcefully at end. Please provide me some jquery solutions so resolve this ? Thanks in advance -Pravin ...

Ttrigger extra paramter

According to the jQuery manual you can send extra parameters (as an array) when calling a trigger. I am using this at the moment: $('#page0').trigger('click', [true]); How would I pick up whether the paramter has come through or not when using this? $('ul.pages li a').click(function() { // Do stuff if true has been passed as an ext...

JavaScript code that can enable the text on the webbrowser to blink once.

I have window application and on that there is one webbrowser control and I want to display the text on the webbrowser blinking one time and then it should not blinked more, is it possible ? I have done with one javascript but it blinks the text frequently but I want text blinking only single time or maximum two time.The java script is...

adding listener to div tag to watching innerHtml content

I have a div tag and i'm changing its innerHtml attribute. And i want to add listener to this div tag to show/hide when its innerHtml changed. ...

Finding the closest grid coordinate to the mouse position with javascript/jQuery

What I'm trying to do is make a grid of invisible coordinates on the page equally spaced. I then want a <div> to be placed at whatever grid coordinate is closest to the pointer when onclick is triggered. Here's the rough idea: I have the tracking of the mouse coordinates and the placing of the <div> worked out fine. What I'm stuck wit...

How to define absolute path of xml, images folder and main swf path in this swf object code?

<script type="text/javascript"> var flashvars = {}; var params = {}; var attributes = {}; swfobject.embedSWF("loader.swf", "flash-banner", "920", "320", "9.0.0", "expressInstall.swf", flashvars, params, attributes); </script> After loading loader.swf I'm getting this error Error #...

Javascript object declaration help

I have defined objects in js as following var newevent = {title: txt, start: new Date(y, m, d, h, mi), end: new Date(y, m, d, h, mi+parseInt(eventtime[itemobj])), allDay: false, editable:eventedit[itemobj], className:eventbg[itemobj]}; My question is, what sense does the following code make? var evt = [newevent]; ...

Can't get syntax correct for dynam. create onclick the ie way.

I was hoping to keep cross-browser compatibility and afaik this is the only issue so far. .setAttribute("onclick", "return showRapidText("+itemnum+");"); This works PERFECT but I'd like to make it IE compatible by putting it in this syntax .onclick = new Function("fnDisplay_Computers('" + alines[i] + "')"); so... I tried .oncli...

javascript regex pattern concatenate with variable

How to create regex pattern which is concatenate with variable, something like this: var test ="52"; var re = new RegExp("/\b"+test+"\b/"); alert('51,52,53'.match(re)); Thanks ...

Jquery get selected checkboxes

Hi I'd like to get the list of selected checkboxes ina page, actually what I really need is th get the text of the element next to the checkbox which is a html element <li> the code is below and its not working Here is my current jQuery: $(document).ready(function () { $('#target').click(function () { alert("in"); var checkVa...

how to redraw markers without redrawing the map? google maps.

I currently have a implementation where some markers coming from JSON list is shown, on a particular area, Now I want to filter these marker depending upon some criteria, I have done the filtering part, and got the filtered list. Now to render this markers on the map again, The current implementation loads the js with a key again, also c...

Javascript Alert Return value / Event

Hey, The question is pretty simple, but i'm not the big AJAX/JS coder, so I have no clue if it's possible. Is there any way that I can check whether or not an alert() was executed on a remote site? Like if I inputted an alert("Welcome to this site"); through a get variable, is there any way to check if it that alert() was actually exec...