javascript

Javascript - Problem with escape characters in bookmarklets...

Hi all, I've got a nice piece of javascript <script type="text/javascript"><!-- var d = new Date(); d.setTime(d.getTime()-86400*1000); window.location = "https://mail.google.com/mail/?shva=1#search/in%3Ainbox+before%3A"+(d.getYear()+1900)+"%2F"+(d.getMonth()+1)+"%2F"+d.getDate(); //--> </script> That works entirely satisfactorily w...

Global JavaScript Variable Scope: Why doesn't this work?

So I'm playing around with JavaScript and came across what I think to be an oddity. Is anyone able to explain the following? (i've included the alerted values as comments) Why is the first alert(msg) inside foo() returning undefined and not outside? var msg = 'outside'; function foo() { alert(msg); // undefined var msg = 'inside'...

How to remove an element without id

I have the following code: <%-- other tags --%> <table> <tr width="100%"> <td width="130" /> <td id="BottomCell" width="100%" /> </tr> <tr> <td/> <td/> </tr> </table> <%-- other tags --%> There may be more than one table on the page. I want the td before "BottomCell" to be removed (or hidden) when the page is ...

document.getElementsByName returns elements more than expected

I have a RadioButtonList <asp:radiobuttonlist runat="server" id="rblList"> <asp:listitem>s1</asp:listitem> <asp:listitem>s2</asp:listitem> <asp:listitem>s3</asp:listitem> <asp:listitem>s4</asp:listitem> </asp:radiobuttonlist> In my client code I'm grabbing the array of radio buttons like this var elements = document.g...

How to call JQuery functions

Hello, I was wondering about the different ways of using a JQuery function on a variable like I know this one $.DoThis(variable); but is there a way to call it at the end like normal Javascript functions variable.$.DoThis(); haha I know this sounds stupid but I need to ask somewhere. Thanks! ...

Spring MVC - Set an actionURL parameter with Javascript

Is it possible to dynamically set a Spring MVC portlet:actionURL portlet:param using javascript? I have tried with the following code, but the id value always comes across as null to the controller. I have verified that setting the portlet:param manually passes the value correctly: <portlet:param name="id" value="2" /> I have also ve...

javascript prototype getting a div wid id and display='none'

i am using protoype and i want to get the div wid id='div_3' and display='none' means in a single line i want to find the element wid these two attribs ...

How do I change the cursor during a jQuery synchronous browser blocking POST?

$.ajax({ url: "/cgi-bin/stats.exe", method: "post", async: false, data: { refresh: "a41" } }); Using ajax post synchronously - "async: false". While it blocks the browser during the active request, what is the most efficient way to change the cursor to the hourglass or display a wait .gif? Perhaps ...

Open flash chart not working

I want to implement Open Flash Chart in my website but it doesn't work. The chart just start loading for a second and the loader animation disappear and nothing happening (Only a blank swf area). i've downloaded the latest version which is 2 and here is my folders scheme: // ROOT // ● JS ● open-flash-chart ● php-ofc-library - open-flash...

Retrieveing ALL head elements in document including iframe

I'm trying to add style elements to all ALL the head elements in a document, including those in an iframe. if i use var heads = document.getElementsByTagName('head'); It just returns the first head element and not the ones in the iframe. this is the complete code : var heads = document.getElementsByTagName("head"); var style = docum...

Is there a way round numbers into a friendly format? (e.g. $1.1k)

Much like the Stackoverlow reputation rounding, I'm hoping to do the same thing with currency $1,000 => 1k $1,000,000 => 1m Is there a library out there already that does this? (preferably in jQuery) ...

window.location call popup up empty dialog on safari

Hi, on a web page i am trying to redirect the browser to another page on the same site. the code is very simple for that: window.location = "/path1/path2" on safari - both windows as well as mac - a message box containing only the text "http://domain.com" comes up. I have tried different ways of specifying this: location.href, wi...

jQuery autocomplete disabled makes autocomplete partially transparent, not disabled

I'm using the jQuery UI's "autocomplete" function on a search on my site. When you change a radio button from 'area search" to "name search" I want it to disable the autocomplete, and re-enable it when you switch back. However, when you disable the autocomplete it doesn't hide the dropdown, it just dims it to 20% opacity or so. Here's my...

Javascript: Unresponsive script error

hi, I get an error message from Firefox "Unresponsive script". This error is due to some javascript I added to my page. I was wondering if the unresponsiveness are caused exclusively by code loops (function calling each other cyclically or endless "for loops") or there might be other causes ? Could you help me to debug these kind of e...

How do I cancel the link action?

I though returning false would be enough to cancel the link action, but apparently it isn't. When I click the link in the code below I do get the 'click' message, which is expected. But I also end up at google.com, which is unexpected. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"&gt; <html> <...

Flash animations with Javascript?

Hi all, How does something like this work without Flash? http://www.dirtyphonebook.com/dashboard/425-205-1921 I right-clicked on it but there's no Flash menu. I love Flash because its stable and works. But is using some sort of Javascript hack for this kind of complex behavior actually a good idea? ...

JavaScript inheritance extend function

I'm having some trouble understanding the IF clause at the end of this function from Pro JavaScript Design Patterns: function extend(subClass, superClass) { var F = function() {}; F.prototype = superClass.prototype; subClass.prototype = new F(); subClass.prototype.constructor = subClass; subClass.superclass = superC...

How can one put together multiple arrays into one string?

I'm having a hard time describing what I'm looking for. If we pretend that we're pulling an array (I've used the .split to get user input data) where each line represents a link. How can I then add an anchor tagg to that link that I'm pulling? I need to be able to put < a href=" + thearray + ">anything< /a>. The reason for this is ...

JQuery - How do I count the number of elements selected by a selector?

I am using $().fadeOut() to fade items out in a list ( < li> < /li>). When the list is empty I wish to hide a parent object. I plan on doing this by checking in my trigger event that fades the list if the count of the objects is 0 then hide the parent element. I can use the fadeOut callback to remove the elements if necessary. The to t...

How to call these type of things using Javascript?

<%= Html.Trirand().JQGrid(Model.OrderGrid,"Grid1")%> I need to call this using javascript? Can anybody tell me? <%= Html.Trirand().JQGrid(Model.OrderGrid,"Grid1")%> I have a Grid1 and Grid2 in my user control both are under div tag,,, I need to display one Grid based on user clicks on Row of first Grid1.. so My intention was to ...