javascript

JS Drop Down menu with submit button

I need to implement a drop down menu like the one in the image. I know how to accomplish something like this when there is no 'go' button but how would I do this with the the 'go' button? Is there a way to allow the user to select a link but not trigger it unless the user clicks the go button? Is there a jquery plugin or something for ...

Check if jQuery method exists

Is it possible? No matter how, in Javascript or jQuery. For example: $.isFunction($.isFunction()); Upd: But how to check method of a jQuery plugin? Sometimes it not ready at the moment of it call and generates error. Example: $.isFunction($().jqGrid.format) ...

Is it possible to explicitly tell a script when to execute, when the page is open dynamically?

Hi, I have a page which dynamically opens each page based upon the tags. I am attempting to execute a script, which is to run when the dynamic page is run from the div id="CreateVids" tag. I'm totally new to this so i'm not too sure what is the problem. I have been looking to see if there is a property of the that I can set but I cann...

How to detect "tab keypress" when focus is at a button using JavaScript

Hi all, I'm just wondering if any of you done an onkeypress on a button. my button is like this: asp:Button ID="btnClear" runat="server" Text="Clear" onkeypress="return goToFirst();"/> the javascript: function goToFirst(evt) { var e = event || evt; // for trans-browser compatibility var charCode = e.which || e.keyCode; ...

'Sanitising' user-submitted Javascript - so it still works!

Hi folks, I plan on having an aspect of my site where the users can submit HTML, CSS, and JS, which is then generated 'live' into full working pages of HTML. Other users will be able to see this. These pages need to have working Javascript on them. I understand that's a pretty major security flaw in itself, but it's very important this...

using JQuery to convert html tr tags to uppercase for string comparison

Hi I have the following JS function: function tblFilter(colToFilter) { var tableToFilter = $("#notesGrid").find("tr"); var columnToFilter = colToFilter; $.each(columnToFilter, function (i) { tableToFilter = tableToFilter.filter(":contains'" + columnToFilter + "')"); }); tableToFilter.show(); }; colToFilter is uppercase and I ...

Grid Inline editing with JavaScript, weird behaviour

I made this invoice page. There is a repeater that generates a table. There are invoice item descriptions coming into td tags encapsulated with div tags like this: <asp:Repeater ID="Repeater1" runat="server"> <ItemTemplate> <tr> <td class="griditem text"> <div class="invoiceDescripti...

How to get a previous page value.

Using C#, I want to get a value from previous page. For example, In a page A i have the textbox value like "apple", i want to get the same value in page B Page A Code. <a href="javascript:void(0)" onclick="window.open('pageB.aspx', 'Add','width=700,height=400')"> Add</a> Above Code is linking a Page B from Page A Ho...

Jquery next adjacent selector with $(this)

Hello, How could i use the adjacent selector "+" with the $(this). I would need a help with the commented lines with //this doesnt work: $(".ExpandCollapse").click(function () { if ($(this).nextUntil('.Collapsable').is(':visible')) { //this doesnt work $(this + ".Collapsable")...

how to randomize an integer variable, with odds on certain numbers appearing

To get a random whole number between 0 and 4 inclusive, I use the following code: var random = Math.floor(Math.random() * 5); However I want the number 4 to be chosen twice as often as the other numbers. How would I go about doing getting a random number between 0-4 inclusive, but with the number 4 appearing twice as many times as 0-3...

eval-ing a function, performance after being evaled.

We all know that the code: var ssum = function(a,b) { return a+b; } is executing faster than eval("var esum = function(a,b) { return a+b; } "); for many reasons. what I want to know is that if a function which was created by eval-ing a string will perform worse than a if it had not been. For the example above it means: will esu...

Bypassing authentication for localhost in order to implement search in Etherpad

I'm trying to implement Nutch + Solr based search engine into my Etherpad installation. The main issue I'm having is that Nutch doesn't support POST authentication. Etherpad and Nutch are installed on the same machine, so an obvious solution would be to find a way to bypass authentication for localhost. This is where I'm stuck. I don't ...

Disabling the context menu on long taps on Android

I would like to disable the context menu that appears after a long tap (touch and hold) on images in my web application. I've seen posts with different ideas how to do it, but none of them seem to work for me. Is there a way to do this on Android via HTML/CSS/Javascript? ...

Cross Origin Resource Sharing with PrototypeJS

Hey there, I am having some trouble with Cross Origin Resource Sharing and Prototye. I have a simple post request to a foreign resource, and for a simple post request there are some rules that must be satisfied: the Content-Type must be on of application/x-www-form-urlencoded, multipart/form-data, or text/plain, a simple request does n...

escaping json string with a forward slash?

Hi, I am having a problem passing a json string back to a php script to process. I have a json string that's been created by using dojo.toJson() that contains a / and looks like this: [{"id":"2","company":"My Company / Corporation","jobrole":"Consultant","jobtitle":"System Integration Engineer"}] When I pass the string back to the ...

Google Maps fitBounds object from left, right and bottom fit in bounds but from top don't

Here is my code. function CICOverlay(json) { /* * @param is a json object containing the search parameters * - IDReiseart * - Hotelart * - IDLand * - Region */ this.param = json.param; /* * @zielgebiet is an Array containing name and geoda...

how to validate radio buttons in javascript?

my html code- <form method="post" name="editorform" id="editorform" onsubmit="return validate_editorform(this)" action="#"> <ol><li> <label for="qtitle"><b>Title</b></label> <input id="qtitle" name="qtitle" class="text"></textarea> </li><li> <label for="tag"><b>Tag</b></label> <table bord...

Checking checkboxes using javascript when there id's have a certain character within

I need to check a certain selection of checkboxes using javascript. All these checkboxes have the letter a at the beginning of the id and other checkboxes have a different letter.I also don't know how many of these checkboxes there will be since they are created dynamically <input type="checkbox" id="a1" /> now if i click on a button ...

Find Links in HTML Document using Javascript/jQuery

Hi! This is a challenge for any Javascript/jQuery ninjas out there: What is the best way (using aforementioned languages), to find all of the links in an HTML document and return them all? In other words, a function that like this - findLinks(document.html.innerHTML) that would return all links found in that HTML. Thanks, DLiKS ...

Refresh a page only when the browser is not minimized and the tab is active

Hello, Could you tell me how to do a autorefresh (every minute) on a page. But I have some constraints, the refresh occur only when : - the browser is not reduce (minimized) - the tab must be active When the browser is restored do a refresh, if the page with the refresh is active. Sample : I have 2 tabs, one on "YouToube" and the othe...