javascript

What are event and UI parameters in Dialog

What are event and UI parameters in jQuery Dialog? Can I get a mouse position using them? $( ".selector" ).dialog({ open: function(event, ui) { ... } }); ...

Dropdown doesn't work on newly added elements

I have multiple dl elements on a page. At the end of each one I have a dd tag acting as a dropdown which includes options for the element (like edit, delete, etc.) Here's the jQuery for the dropdown: $('dd.optiuni').mouseover(function() { $(this).find('ul').show(); }); $('dd.optiuni').mouseout(function() { $('dd.optiuni ul').h...

Javascript: have div always remain at the top when it reaches the top edge of browser with jquery

how to have a div that always stay on the screen? Lets say i have a div at the left hand site. When the browser is scroll to the bottom, the div will remain there ONLY when its' top reaches the top edge of browser screen so that it will not be hidden. I am using jquery too. Thank you. ...

ASP.NET - Comet Pushing messages from server to all clients

Hi All, I'm making an application with server sided variables that change every second. Every second those new variable need to be shown at all the clients that have the webpage open. Now most people told me to go with comet because I need to push/pull the data every second, now I've got a few questions: What would be a better soluti...

How to do a screen capture of content on web page/join 2 images

I have a page where I am using Raphael.js to actually allow user to move a dot around the canvas which has a background image. What I am trying to do is to capture the end image of the canvas where I'll be able to see where the user placed the dot after the user clicks on a 'confirm position' button. I've thought of two methods, however ...

list box manipulations

I am using a asp.net listbox. I have two buttons one to add items to listbox and another to remove. I am using javascript function to remove items from the listbox. When I add to the listbox after removing. The removed items are also getting added. <asp:ListBox ID="sLstbox" runat="server" Width="250px" Height="150px" TabIndex="10"></asp...

Flash backup image

Hi guys, so I have a pretty big flash file on my homepage, which raises a few issues about what to do if the user doesn't have flash player installed on his/her PC. I would like to make sure that if the user has a old version of flash player, or doesn't have it at all, a backup image will display in place of the flash, how can I accompl...

In javascript, how can I detect when the browser brings up the open/save/cancel prompt when loading a file?

In javascript, how can I detect when the browser brings up the open/save/cancel prompt when loading a file? If possible, is it the same for all browsers? I'm trying to fix a problem with users clicking a download button, being impatient and clicking it again, and again which is taxing our servers. I tried just hiding the button while t...

How can I get better at OOP?

This might come as a strange question to many of you, and I don't actually know if it is correct to say OOP in this context, because OOP (object-oriented programming) is usually associated with programming languages like C++ and Java, and not lightweight programming languages, or scripting languages. My question, however, is in the categ...

how to refer to json fields

Let's asume that I have json variable: var json ={"A":"a","B":"b","x":"y","a":"b"} When I want to refer to A i just write json.A How to do it when I have key in a variable, ie: var key = "A"; Is there any function that returns value or null (if key isn't in json)? ...

Adding Jquery to an new Window "window.open"

Hi there, what about adding jquery to a page. Like this: Clicking on a bookmark (which loads the same url into a new window) Adding Jquery.js Run some jquery.. ...

Check if copy and paste is enabled

On Firefox (at least) JavaScript copy and paste functions are disabled by default. Is there anyway to check if the functionality is available so i can hide some buttons if its not? ...

Javascript SWF Communication by Flashvar

I have a SWF which has two button one been Browse button and other bein upload. I dont Know whats the code behind the SWF file but being asked to pass flashvar variable like 'uploadURL ='+ ourl where ourl is url of the handle.aspx which handles the uploading operation I did all this and wrote code in handler.aspx which obtains file from ...

innerText solution for Firefox

I have written a lot of pages last month and today I realized that innerText doesn't work in Firefox. I found textContent, but I don't want to dig my tons of pages. Also sometimes I used jQuery.text, it seems to work everywhere. So question: what is the simplest way out of this hell? ...

Javascript Orientation Change doesn't work with PhoneGap on iPad

I'm adapting a small HTML/CSS/Javascript driven web magazine as an iApp for the iPad with the great mobile framework PhoneGap. Everything works great, except the orientation change from portrait to landscape mode. I use the following Javascript code in the header of the index.html (portrait): var isiPad = navigator.userAgent.match(/i...

YUI remove javascript comments

Hi, I need to remove comments (the "// This is a comment" like comments) from some Javascript code, I'm using YUI compressor, there is an option to do that? Thanks Thanks for the response, I'm trying to merge several scripts and after compress with YUI; I've found if I compress and then merge the scripts it works, but if I merge and ...

javascript, jquery time format

Hi everybody , I have a question, how can I change time from 24hr format to 12, the easiest way, in javascript or Jquery . This is what I have : TempDate = $.datepicker.formatDate('MM dd, yy', TempDate); var ChangeDate = TempDate + " " + TradeTime; now TradeTime= 15:59 , but I wanna be 3:59PM What is the easiest way , or can I...

How to disable, enable, then disable again scrolling in ipad/iphone with e.preventDefault(); ?

I have it disabled already, and I can enable it again. I used: document.ontouchmove = function(e){ e.preventDefault(); } In the document.ready(); to disable it. And I used this to enable it. function doTouchMove(state) { document.ontouchmove = function(e){ return state; } } I have it so when a user doubl...

How to add JS effects on rendering AJAX parts in JSF2?

In JSF2, I can update part of view by AJAX. I assume part of components tree is just generated/updated on server, rendered to HTML and this HTML is sent to client. Then inserted into DOM where appropriate. This works, but I wonder if I could add some jQuery (or other JS) effect when I want this new HTML part to appear? What if I want it...

javascript split

I can use JavaScript's split to put a comma-separated list of items in an array: var mystring = "a,b,c,d,e"; var myarray = mystring.split(","); What I have in mind is a little more complicated. I have this comma separated string: "mystring_109_all,mystring_110_mine,mystring_125_all" how do i split this string in to an array ...