javascript

jQuery/Javascript: get full height of element?

hey guys, my blog has a content div with an id of #content. When i Select it e.g. with Firebug it outlines the full height of the div. With all it's padding & margin at the top and the bottom. jquery height() returns only the inner height of the element it self. how can i query the FULL height of the element. If there are other eleme...

Is there a way to pass a variable to keypressed function?

I am trying to send the document and the control that the key was pressed in to the keypressed function. Here is my code: //Namespace MyExt.BrowserOverlay = { init: function() { var appcontent = document.getElementById("appcontent"); // browser if(appcontent) appcontent.addEventListener("DOMContentLoad...

Event bubbling jqeury .delegate() or .live() after click event

Hi all, I've tried so many different possibilities to achieve what I feel like should be a simple code execution. I am loading DOM objects from the server via .load(). One of the loaded items is an input text box with a date in it. I want to load the jdpicker (a plugin datepicker) when I click on the input box. Due to the behavior of .li...

How to add string object's value into JS regular expression?

var foo = "blaa"; var regex = /foo/i; results in /foo/i instead of /blaa/i. ...

Graceful way to tell users of IE7 and below to go away?

TLDR: Tell IE6/7 users to leave in a nice way :) whilst blocking them from all content. Basically I do not need people using IE7/6 lower on my web app. Was thinking of just doing a doc.write after load to wipe the page with a message of "Sorry your browser is outdated" has anyone done similar and found a nice friendly way to tell them ...

JavaScript Namespace

I want to create a global namespace for my application and in that namespace I want other namespaces: E.g. Dashboard.Ajax.Post() Dashboard.RetrieveContent.RefreshSalespersonPerformanceContent(); I also want to place them in seperate files: Ajax.js RetrieveContent.js However I have tried using this method, however it won't work b...

Tracking clicks on videos in Google Analytics

A client has a site where video content is populated by AJAX from a video CDN. Each link is built like so: <a class="thumb-link" href="/?video='.$video->id.'" onclick="show_video('.$video->id.', \''.$section.'\'); return false;"><img src="'.$thumb.'" width="100" height="65" alt="" align="left" /></a> But they report that analytics is ...

JavaScript prototypes

Possible Duplicate: JavaScript: Class.method vs. Class.prototype.method What's the difference between creating a prototype like this: Date.foo = function(bar) { alert(bar); }; And this: Date.prototype.foo = function(bar) { alert(bar); }; Why/when should I use either? ...

Change link targets

Is there a way (I assume it would be with javascript) that I can have a checkbox or link on my page that will make all the links on my page have target="_blank"? I want to have a checkbox that says something like "Open all links in new page/tab" on my site that when checked will change the target and unchecked will put it back to how it...

JavaScript regex: find non-numeric character

Let's say I have these two strings: "5/15/1983" and "1983.05.15". Assume that all characters in the string will be numeric, except a "separator" character that can appear anywhere in the string. There will be only one separator character; all instances of any given non-numeric character in the string will be identical. How can I use reg...

Alternative method to include JS files

This question is a follow up question for this question. If some browsers download JS files even though the user has JS disabled, would it make sense to include JS files using JS to ensure the user isn't forced to download the JS unnecessarily? For example: function inc(filename){ var body = document.getElementsByTagName('body').i...

Javascript Git client

Is there a Javascript implementation of Git? I'm wanting to use HTML5 to create a rich Javascript application and have the idea that I could use git to track changes to the data. So, I'm wondering if there is a javascript implementation of a git client, or maybe some way of controlling a git repository by making POST requests. ...

how to hidden the "MapTypeControlStyle" control on google-maps v3.

this is my pic : this is my code: var myOptions = { zoom: 13, center: latlng, mapTypeControlOptions: { style: google.maps.MapTypeControlStyle.DROPDOWN_MENU,position:google.maps.ControlPosition.TOP_LEFT}, mapTypeId: google.maps.MapTypeId.ROADMAP }; var map = new google.maps.Map(d...

Trigger a jQuery keyup event only when an <input> element is not focused

I can use jQuery to bind a function to a keyup event within the context of an <input> element such that the event only fires when the <input> element is focused: $('#my-input').keyup(function(e) { // only fires when the focus is on the <input> element } How do I bind a function to a keyup event outside the context of the input eleme...

get referer of website that is requesting your js file

I have an embed script that simply does this: document.write(unescape('%3Cscript src="' + mp_protocol + 'blah.cloudapp.net/js?location="' + window.location +' type="text/javascript"%3E%3C/script%3E')); As you can see right now the URL of the webpage that is embedding the code is passed in using window.location. But this can easily be ...

How can I make a fixed floating menu for Android?

I am trying to make a floating menu to be at the bottom of the page. I have it working with Chrome but for some reason on Android it doesnt scroll right. Ive seen a ton of people have this problem online and there was an doctyper-iphone solution but I tried it on my droid and it crapped out...it almost worked though. http://208.229.14...

Is there a way to abort a SlickGrid asynchronous render?

I have a search page whose results are rendered in a SlickGrid. It is an ajax search that executes onkeyup, so it's possible for a search to be performed, the Slick.Grid instance's render to be called, and have another result come back before the first asynchronous render completes. I'd like to cancel the initial render as soon as the se...

Ajax Google Visualization API Gauge with jquery

Hello, I am looking to create a dashboard gauge that updates via ajax. Below is the code I have. I have the ajax code but just am unsure on how to update the gauge. Any suggestions? google.load('visualization', '1', {packages:['gauge']}); google.setOnLoadCallback(drawChart); function drawChart() { ...

How to get full path of a file with FileUpload Control?

Hi, i am using FileUpload Control in my application to upload user information.when i used javascript to get the value of fileupload Control it give only the name of file in mozilla while in IE it's give the whole path with file name. And i want the file name with whole path. mozilla Result - user.doc IE Result - /usr/local/user.doc (w...

append text javascript,don't get values

This is the code in append input box in java script,i don't get there values in the inputbox <script type="text/javascript"> function addInput() { var x = document.getElementById("inputs"); x.innerHTML += "<input type=\"text\" name=\"box[]\" id=\"box[]\"/>"; i++; } function getdata() { } </script> <input type="button" on...