javascript

how to capture the resize event in IE8

The resize event does not seems to get fired in IE8 . It works perfectly in Firefox and chrome . $(window).resize(function() { alert( " resize called " ) ; } Am I missing something . ...

send an url parameter to server from url (PHP/JavaScript)_

http://nomilead.com/create.php?uid=abc&key=c79a&web_url=http://dinesh707.blogspot.com/ Here im trying to send the url as a parameted "web_url". The shown is an ajax request that sends to a php server back end. from php end im trying to capture this by $web_url = $_GET["web_url"]; but it does not work. Please help me out ...

How to get request uri from location.href in javascript?

What I get from location.href is like this: http://stackoverflow.com/questions/ask But I only want to get questions/ask (no / at the first character) How to achieve this? ...

Click to move a div to the mouse co-ordinates

I have the following code: http://www.project-vanquish.co.cc/gridtest/drag-grid.html The plan is to allow the user to control that div (with the smiley face) in 3 ways: 1 - by the Cursor Keys on the keyboard 2 - by dragging the div 3 - by clicking on an area and the div will move to that position The problem I have is that when I click...

how to add javascript variable value in facebook feed text

I m trying to add javascript variable value to facebook feed text function as below var question = document.getElementById("question").value; var attachment = { 'name':'xyz', 'href':'xyz', 'caption':'testing', 'description': question , 'media':[{'type':'image','src':'9090.gif','href':'xyz.php'}] }; Facebook.str...

Check if jQuery or mooTools are loaded

Hello ! In my project I am using jQuery in client side and mooTools in admin side. I would like to be able to write some part of code (google maps functions, etc) which will be common for both of that libraries. Is it possible to check if jQuery or mooTools libraries are loaded and use proper behaviours ? $(document).ready(function() ...

HelpBallon.js in ASP.NET UpdatePanel

Does someone know, how to get the HelpBallon.js (http://www.beauscott.com/2008/03/02/helpballoonjs-version-20/) work in an ASP.NET UpdatePanel? After a postback all images are lost. ...

jQuery gt(0) selector issue

Hi all. I have a problem with my jQuery selector. See below results from firebug js debugger: $("#tblComponentData tr:not([disabled=disabled])").length 9 $("#tblComponentData tr:not([disabled=disabled]):gt(0)").length 5 As you can see there is only 1 difference between these selectors: the second selector has "gt(0)". But...

what is this ? Mootools class or object ?

I view a file and see that var Modal = { presets: {....}, initialize: function(){...}, addClick: function(){...}, extend: $extend } Modal.extend(Events.prototype); Modal.extend(Options.prototype); Modal.extend(Chain.prototype); i think Modal is a object. addClick key with value is a function i call it like addClick function....

Nested javascript onmousedown events

I would like different nested onmousedown events. For example, consider the following code: <div id="parent" onmousedown="foo();"> <div id="child1"> </div> <div id="child2"> </div> <div id="child3" onmousedown="bar();"> </div> </div> I'd like it so that clicking on any area that's inside the parent div, including child1 and chil...

Can a UIWebView web form be populated programmatically?

If you have a UIWebView, and load a web page with a form on it, can you programmatically populate that form? Either with objective-c or javascript, or something else? ...

Get the print screen image from the clipboard

Is there a way to Get the print screen image from the keyboard. Say for example I had a image hosting site and wanted a feature where users could paste in an image and simply host it that way. would that be possible? Sorry this is such a vague question. EDIT: Would it be possible with some sort of third party plugin? Are there any exi...

Content-dependent templates/partials with moustache.js

I'd like to use moustache.js to render the following JSON structure: [ {type:'img', src:'some_url'}, {type:'text', text:'lorem ipsum ...'}, {type:'link', href:'some_url', label:'click here'}, // more entries ... ] I'd like to render each item depending on type: img should br rendered as <img src="{{src}}">, text as <p>{{text}...

If a webserver has a host name and a different alias DNS name, what will be the value of document.domain?

I have a webserver with the following host name and DNS alias name. Host name - server1.aa.xx.company.com Alias name - server1.bb.xx.company.com In the above scenario, what will be the value of JavaScript DOM object document.domain? Will it be server1.aa.xx.company.com or will it be server1.bb.xx.company.com? ...

HTML image loading problem

Hello, I have a site where I have to dynamically load images. I must know their width/height before laying them down, so I am using the onload event handler. What I found anyway, is that sometimes those values are 0/0 even in the handler (this happens on Chrome and as I am targeting webkit, this is the browser to use). Is there any way ...

Using Google Analytics asynchnonous code from external JS file

I'm trying to add the asynchronous version of the Google Analytics tracking code to a website. I'd like to keep the JavaScript in a separate file, and call it from there. Here's what I've currently got in my .js file: function addLoadEvent(func) { var oldonload = window.onload; if (typeof window.onload != 'function') { ...

json to javascript - google charts

In the past I have used the following method to parse the json data appropriately so I can populate a select box: var request = null; request = $.ajax({ type: "POST", url: "url goes here", dataType: 'text', success: function(returned){ returned = JSON.parse(returned) $.each(returned, function(selectid,item) { ...

JavaScript Date.parse() and null dates

I'm trying to sort a list of dates, but I'm struggling with null dates which aren't being handled consistently. So I need something like: var date = Date.parse(dateString); if (!date) { date = Date.MinValue; } but I'm struggling to find the correct syntax. Thanks Update: The bug turned out to be a different problem. I have Dat...

How to remove default A B markers on google maps route direction

var directionsService = new google.maps.DirectionsService(); var directionsDisplay = new google.maps.DirectionsRenderer(); var startMarker = new google.maps.Marker({ position: start, map: map, icon: 'start.png' }); var stopMarker = new google.maps.Marker({ position: stop, map: map, icon: 'stop.png' }); directionsDisplay.setMap(map); v...

Remove, replace or disable dynamically-generated ASP.Net js code

I am working with a few .Net 4.0 webforms controls such as the Menu control and while I think it's great that I can now declare the way in which controls are rendered (i.e. as either tables or divs), I can't switch off the automagically-included javascript that manages the hover events for those controls, for example: new Sys.WebForms.M...