javascript

What's the best way to grab the number in this url string with jQuery or vanilla javascript?

"/organizations/1/media/videos/11" I would like to just grab that 1 . Not sure how to exactly do that. Any ideas? ...

Webbrowser control , Detect internet connection

Hello Everyone, Here is my code scenario, I display html page in webbrowser control. The content will be loaded from some RSS url dynamically (used JQuery to load the content from URL) and displayed in WB. My problem is, i have to check for the "Internet Connectivity" when a loop is completed by scrolling text. I tried using "navigat...

jQuery event not defined on mouseover/mouseout...

hi i have a function that worked fine using jQuery 1.3.2 but now i am trying to run it with 1.4.2 and i get the following error "event is not defined". here is the code simplified: <div id="mapcontainer><img href="" usemap="#rage_image_map"> <div id="mytext"></div> </div> <map name="rage_image_map"> <area shape="poly" href="asth...

textfield with link

hi, as I can get my textfield displays the contents as <a>? items: [{ xtype: 'textfield', value: '<a href="www.google.com"> www.google.com </a>' <-- }] ...

Are there any good videos to learn programming basics which are required to learn javascript?

Are there any good video to learn programming basics which are required to learn JavaScript, then jQuery later. for the person who is already having good command over xhtml and css ? future aim is not to learn any server-side language, php, asp.net, ruby ,etc. just pure and advanced javascript/jQuery. Video for absolute programming begi...

How to dynamically insert a <script> tag via jQuery after page load?

I'm having problems getting this to work. I first tried setting my script tags as strings and then using jquery replaceWith() to add them to the document after page load: var a = '<script type="text/javascript">some script here</script>'; $('#someelement').replaceWith(a); But I got string literal errors on that var. I then tried enc...

jquery selector not working in IE8

This code results in an error at second line ($('boxes div.box')) <script type="text/javascript"> $(document).ready(function () { boxes = $('#boxes div.box'); images = $('#images > div'); boxes.each(function (idx) { $(this).data('image', images.eq(idx)); }).hover( function () ...

How to create a windows explorer-like functionality?

I am building a web application that needs windows explorer-like feature. I have implemented jQuery File Tree but that one works for left navigation only. Any ideas that I can work on or any ready-made solutions out there? Following is the PHP code that builds the ul and li tags: if( file_exists($root . $_POST['dir']) ) { $files = scan...

Alert user if session is going to expire, option to renew session

I have been looking all day for a PHP or JavaScript solution to do this. I would like to alert the user their session is about to time out (popup), ability to extend the session time. Here is a visual if you need one on this page EDIT: jQuery is the framework if that helps ...

Javascript performance and minification

Does anyone know if there's any benefit in 'minifying' locally-stored javascript code to squeeze more performance out of the javascript engine? Usually minification is done to reduce bandwidth requirements/costs, or obfuscation, but would there actually be any performance benefits? In other words, does this code: let i=[1,2,3,4,5,6];l...

Can you capture events from the 5 way directional buttons in Opera Mini using JavaScript?

Can you capture events from the 5-way keypad of a device using Opera Mini using Javascript? (My guess is the answer is no, but I figured I'd ask anyway) ...

how does Google append search parameters to url without reloading page?

How does Google append search parameters to url without reloading page? Does anyone know how they do it? I know about the HASH trick and the webkit pushState function. I don't think they are using either. Their solution is cross browser compatible, do they use a combination of different methods for each browser? ...

javascript passing variables from a method with a loop to a click function

Hi, basically I'm trying to pass a variable that is defined in a JSON array that is parsed through in a for loop to be accessible in a click statement. $(document).ready(function() { getJSON(); var usedID; }); function readJSON() { for (var i = 0; i < json.array.length; i ++) { usedID = json.array[i].id; var template = $('re...

What's the big O for JavaScript's array when used as a hash?

What's the big O for JavaScript's array access when used as a hash? For example, var x= []; for(var i=0; i<100000; i++){ x[i.toString()+'a'] = 123; // using string to illustrate x[alpha] } alert(x['9999a']); // linear search? One can hope JS engines will not use a linear search internally O(n), but is this for sure? ...

Javascript Metaprogramming

Is there a way to specify something similar to the following in javascript? var c = {}; c.a = function() { } c.__call__ = function (function_name, args) { c[function_name] = function () { }; //it doesn't have to capture c... we can also have the obj passed in return c[function_name](args); } c.a(); //calls c.a() directly c.b()...

jQuery ui ReSizable with scroll bars

Hello, I am trying to have a resizable on a div, but the resizer handle is always contained within the div can I have it where scrollbars end. /////////// Edit /////////// I have achieved it with jScrollPane but after using jScroll I am unable to resize horizontally. ...

How to make everything in a textfield be capital letters / uppercase?

I want to make everything I write in a textfield to be capital letters. As I write, not after losing focus. How do I do this using jQuery? ...

ASP.NET MVC EditorFor custom javascript

The following statement: <%= Html.EditorFor(model => model.Material.Serial) %> Generates the following code; <div class="editor-field"> <input type="text" value="" name="Material.Serial" id="Material_Serial" class="input-validation-error"> <span id="Material_Serial_validationMessage" class="field-validation-error">Debe in...

storing html-nodes as key in array

Hi, I want to store elements as the keys in my array and object as values,for example - var arr = []; arr[ document.getElementById('something') ] = { data: 'something' , fn : function(){ } }; But the problem is: If I will add another element with the key of : document.getElementById('otherthing'). And later will try to get the value ...

JavaScript replace all / with \ in a string?

Hello, I have a javascript file that is ran through a windows job using cscript. However, I can't seem to fix this thing to work correctly. Inside the file, it basically takes a URL and transforms it to a UNC path. ex: http://mysite.com/document1.htm to \myserver\document1.htm However, I can't seem to get the /'s to goto \'s and am ...