javascript

innerhtml workaround for IE td elements?

I have the following function: <script type="text/javascript"> function changeText(elem){ var oldHTML = document.getElementById(elem).innerHTML; var newHTML = "<span style='color:red'>" + oldHTML + "</span>"; document.getElementById(elem).innerHTML = newHTML; } </script> And the following HTML: <table> <tr> <td id = "foo">bar...

JS to monitor data usage?

I'm building a simple html5 app to monitor the total network traffic that's incoming and outgoing. Is it possible to know your bandwidth usage using js? ...

Worldwide location (country, region, city) select plugin for Rails, jQuery or Google Maps API?

Is there any plugin which will help to create a dropdown menus for countries, regions and cities? At first user chooses country, then he has his region dropdown menu updated according to which country he has chosen, he chooses region and after that from 3rd menu a city. Plugin can be either for Ruby on Rails, jQuery or maybe javascript ...

JavaScript / jQuery Global onError Handler

Hi All, I've been asked to add the HopToad JavaScript Notifier to a site. The JavaScript can be seen here. What I am wondering is if there is a way that I can set a global error handler for JavaScript / jQuery the way I can with ColdFusion, where any error that occurs, AJAX or just in a function, causes the HopToad.notify(e) function t...

arrow keys not working in fancybox

Ok this is too weird! I have an input box within a fancybox, when I type something and want to move between characters and when I press the left or right arrow keys, it doesn't move... The arrow keys just doesn't work! anybody faced a similar issue before? Thanks... ...

How to generate a XML from XML in jQuery (Javascript)?

I'm trying to generate a XML from client side XML according to this link. But it isn't work. Here is my js code: // XML Builder $.createElement = function(name) { return $('<'+name+' />'); }; $.fn.appendNewElement = function(name) { this.each(function(i) { $(this).append('<'+name+' />'); }); return this; } ...

How can i pass JavaScript dictionary to action result?

i have a java script dictionary. its dictionary<string,dictionary<string,string>> if it is helpfull. i cant pass it to controller class using jquery ,ajax is ther any way to do that? <script language="javascript" type="text/javascript"> var dictionary = {}; var props = {}; props["test1"]="test1"; props["test2"]="test2"; props["test3"...

Using jQuery, find the links that contain a certain string and add a class

Hi, I have the following HTML structure: <div><a href="link1">blah</a></div> <div><a href="link2">blah</a></div> <div><a href="link3.swf">blah</a></div> <div><a href="link4">blah</a></div> <div><a href="link5.swf">blah</a></div> <div><a href="link6.swf">blah</a></div> Using jQuery I want to retrieve the links that contain the '.swf' e...

How to debug JAVASCRIPT events? Or how to make all functions call trace?

Hello everybody! For example there is a button. It is wrapped by <div>. When pressing to this button, there is javascript function call happen, then another function, then calling by ajax to the server and if it's OK, javascript redirecting this page to another page. It's hard to debug. Is it possible to "catch" this event? I.e. to k...

Absolute path in JavaScript script tag

Is there an absolute path while declaring the tag? this will resolve if I have a aspx page in a folder (one level) script src="../Scripts/jquery-1.4.1.js" type="text/javascript"> this will resolve if I have a aspx page in a folder (two level) script src="../../Scripts/jquery-1.4.1.js" type="text/javascript"> this will resolve if I h...

Stop propagation with jquery delegate/live function not working

Heres the problem html: <ul id="update-list"> <li class="update" onclick="window.location('some_url')"> <h2> some header </h2> <p> some paragraph </p> <div> <a class="popup-link"> <span> Show Popup </span> <span> + </span> </a> </div> </li> // this repeats n times //... </ul> When i click on .popup-link li...

Identical hashes for a guid in both C# and javascript

I have a problem where I need to be able to generate identical uniformly distributed numeric hashs for a GUID in both javascript and C#. I guess that would prevent me from using Guid.GetHashCode() in C#, since I can't reproduce the behavior in JS without reverse engineering the C#. Is there a fast way to produce hashes from guids/string...

Creating a <div> at runtime

I want to know whether i can create <div> at runtime using JavaScript or any other method: when clicking a button on one <div> another <div> should appear, and both <div>s should lay above the html page below (i.e floating <div>s). ...

finding a certain tr by attribute in an array of tr's

hi im trying to find a tr inside an array of tr's the attribute name is docId is there anykind of jquery selector for this? i dont want to just iterate throught the array with a for loop and find it myself. unlesss you will say i have no choice... thank you ...

create unordered list dynamically using jquery

hello folks., how to create unordered list dynamically using jquery? i read the image filepath(href and src) from xml file. <ul> <li><a href="images/test1.png"><img id="imageSlide" src="images/test1.png" alt="" /></a></li> <li><a href="images/test2.png"><img id="imageSlide" src="images/test2.png" alt="" /></a></li> </ul...

Survey 'overlay' functionality for campaigns

I am looking for the overlay that comes down from the top of the screen and lets people either go to the survey or select “no thanks.” What kind of flexibility do we have with this functionality? Can we put any content we like in that space (i.e., text and images)? ...

Problem using window.location in a function called from onsubmit

I'm currently creating a very small form on my homepage using HTML and JavaScript. I've run into a problem I'm pretty sure I could circumvent somehow (probably in a pretty ugly way though), but I got interested in why this error appears. I have a form on my page which I specify in the following way: <FORM name="form1" onsubmit="submitT...

Validate two dates of this "dd-MMM-yyyy" format in javascript.

I have two dates 18-Aug-2010 and 19-Aug-2010 of this format. How to find whether which date is greater? ...

Opening a Socket.IO connection in a google chrome extension

Hi there, I'm trying to figure out how to open a connection to an external Socket.IO server every time the user visits a new page from a google chrome extension. This is my first extension, so it's a bit tough. I tried using an iframe and the history.onVisit event, but no luck so far. ...

how can we add a doctype using javascript

hi to all, i want to add doctype using javascript. when a doctype already exist i am able to modify it. but when it is null, not able to add new doctype.. how can i do it in JS ...