Skip to main content

Posts

jQuery FullCalendar timezone syncronization

I am using the jQuery Fullcalendar plugin (http://arshaw.com/fullcalendar). I am only using it for "full day" events. When the user creates an event, I store it in my database via php as a date (2012-01-12). When sending the list of events to FullCalendar via ajax I convert the date to UNIX time. The problem I am foreseeing, is the case where say the server is in the US with a US timezone, and the client is in Europe. The server sends an event for 2012-01-12 00:00:00 (US Time), which gets converted to a unix time. Then the client may see an event that is at 2012-01-12 08:00:00 (8 hours later). How can I make sure that if an event is at midnight, then it's at midnight EVERYWHERE - no need adjust any timezone. If a user creates a full day event on January 12th, I need every user around the world to see it on that same date as well.

IE 7 expected identifier, string or number

Im having a problem and cant seem to find it for the life of me because my code works in all other browsers except IE7. This is the error im getting "expected identifier, string or number" This is my code. function calculate() { var principal = document.loandata.principal.value; var interest = document.loandata.interest.value / 100 / 12; var payments = document.loandata.years.value * 12; var x = Math.pow(1 + interest, payments); var monthly = (principal*x*interest)/(x-1); if (!isNaN(monthly) && (monthly != Number.POSITIVE_INFINITY) && (monthly != Number.NEGATIVE_INFINITY)) { document.loandata.payment.value = round(monthly); document.loandata.total.value = round(monthly * payments); document.loandata.totalinterest.value = round((monthly * payments) - principal); } else { document.loandata.payment.value = ""

Stretching a HTML Input Box alongside additional input?

I'm using jQuery on this site, which has form inputs. I'd like one particular field to get longer (width) as the user enters data and space runs out. How can I calculate when I ACTUALLY need to make the input ( type="text" ) longer? What works for one browser may not work for all browsers. Is this something that can't be calculated, so everybody does it based on trial and error within each browser? Will I need to resort to this and tweak stretch values with a .keyup() that checks the value?.. EG.. $(".stretchInput").keyup( function(event) { var someValueAdjustedByTrialAndError = 30; var stretchPastLength = someValueAdjustedByTrialAndError; var stretchBy = 5; var baseWidth = 100; if ($(this).val().length > stretchPastLength ) { $(this).css('width',(baseWidth + ($(this).val().length - stretchPastLength ) * stretchBy ) + 'px'); } else { $(this).css('width',''); } });

JSON parse with jquery?

I could use some help with the syntax when using jquery to parse this json data coming back from the server. I have tried several examples from stackoverflow and other sites and for some reason I keep getting undefined as the out put instead of the id numbers. Each one should be its own line. { "ROWCOUNT":7, "COLUMNS":["ID"], "DATA":{"id":"211","212","213","221","222","223","232"]} }

CSS, Javascript functionality issue relating to styled input buttons on newer browsers? (IE 8/9, FF 9)

I'm working on a site where I have input buttons (styled using CSS) that are a part of a form. For example, see below for sample code <input type="submit" name="buttonSave" value="save" id="buttonsavejs" class="button_image button_style"/> I've just found an issue where if a user clicks on the button, it moves a few pixels below and then expected action takes place intermittently . But intermittent , I mean that sometimes it works (redirects the user to the next page) and sometimes nothing happens. The developer who worked on this previously hasn't documented his code much, so I'm trying to work from scratch here (so excuse the lack of details). Anyway, after testing the code, it appears that the issue lies with how newer browsers are rendering the css and javascript. Here's a snippet of the javascript behind the button's functionality: $("#buttonsavejs").click(function(){ $(&quo

jQuery IF var = value or #id clicked

I have the .live aspect working now so if links are clicked, my function is executed, but I'm trying to figure out how include an option for a direct link to the content as well. Something like this: $(showDiv).is('shipping-timeline') or $("#inm_if_hc_shipping_timeline").live('click', function() { [code to show and hide divs] }); showDiv contains the value that identifies the proper id, extracted from the URL. My Question: How do I construct the IF statement to execute if either case is true? Can anyone help? Thanks! UPDATE: So I took the IF parts from Graydot's answer and applied it to my code and here is a more complete example of what it looks like now: $("#inm_if_hc_faq").bind('click', function(e) { if(showDiv == 'faq') { // prevent default behavior e.preventDefault(); $("#inm_if_hc_content_faq").show("slow"); $("#inm_if

How to execute Jquery-code in a dialog which received its content via $.get

Let's say the following code exists in template_A popping up a dialog which displays content from template_B. The html is presented fine in the dialog but unfortunately any javascript included in template_B does not run. Jquery & Jquery-ui are included in template_A. template_B has no javascript-includes as it is represented by a div belonging to template_A. JS in template_A : var win = $(document.createElement('div')); $.get(url, function (html) { win.html(html); win.dialog("open"); }); template_B : <div id="content"> <script type="text/javascript"> $(function () { // this never executes, // js-debugging won't enter this part... }); </script> </div>