javascript

Events in jQuery UI Datepicker with json data source

I want to display events in the jQuery UI Datepicker. I want the days that have events to be styled differently from days that don't have events, and I want to display a custom tooltip with the event details when hovering dates with events. The solution to the question "jQuery UI Datepicker with jQuery tipsy" gets very close, but doesn'...

jquery, work with date

Hi, how in jQuery work date? I want to perform mathematical operations to date. var date = '2010-11-23 21:32:31'; var date = date - 70; alert(date); how get: 2010-11-23 21:31:21 Thanks ...

How come changing styles with document.getElementById() works with styles set inline but not internally?

If I set a style inline like this: <div id='myMenu' style='background-color:red'></div> Then in JS call alert("document.getElementById('myMenu')style.backgroundColor"); The result alert box would report "red" However if I set the style internally in the via a class or id <style type='text/css'> .menu { background-colo...

trying to add hierarchy constraints to delegate()

I've got a delegate statement that works like so: $("body").delegate("tr[type='option']",'mouseenter',function(){ The problem is that it's grabbing elements from tables I don't want. So I tried: $("body").delegate("table[class='ms-MenuUI'] > tr[type='option']",'mouseenter',function(){ Which isn't working at all (though I'm not get...

jQuery .animate slider looping in double digits

I have a set of 15 horizontal divs that slide using jQuery. It works great until I get to slide 11. From then on instead of moving to the next slide it will loop through the whole sequence first before it gets to it. So it still works but the loop slide is a bit annoying. Any help is appreciated. //curPanel = is the current div slide ...

Get Map Object in Javascript after using CodeIgniter Google Maps API

Hi, I'm using the codeigniter library for the google maps api. I load the map using the library located on the CI Wiki: http://www.phpinsider.com/php/code/GoogleMapAPI/ I want to then use javascript on the map object after loading the page. How can I get the map object in javascript? Can I use GMap2 on the same div? Won't that recreate ...

How To "Endless Document" Script (like Skittles.com)

How did they accomplish this? Have you guys seen: http://www.skittles.com? The site never ends! ...

How do you make linebreaks in a HTML textarea result in breaks in the string?

I have a HTML <textarea> that I want to be able to make when the user pushes enter in the textarea it results in a linebreak when the string is stored in a variable and printed on the page. How would I do this? I have seen it done before but I am not sure how to do it. ...

Javascript Date objects and Daylight Savings Time

I'm seeing some behavior I don't understand with Javascript date objects and DST transitions. If I execute the following in Chrome's javascript console var date = new Date(1268535600000); //2010-03-14T03:00:00.000Z (21:00 03-13 America/Chicago) for(var i = 1; i <= 12; i++) { var time = date.getHours(); console.log(time) ...

beginner Javascript ajax form help

Hello all I'm new to this whole thing still. I would like some help figuring out how to do this please. I can pull info out of a database and put stuff in using ajax/javascript but I cant figure out how to complete the problem below. I want to be able to make my php form submit and update with out page refresh. Example. Page1. Main p...

I want to create a bookmarklet that will search for a text and replace with a hyperlink

So, I want to search for a text (say "wikipedia") and have all the "wikipedia" in the page turn into a link that redirects to wikipedia. Thanks! ...

JS/Jquery: how to check whether dropdown has selected values?

Hi, I've googled and tried a number of ways to do this but none work for me so far. What I am looking for is quite simple: I want to be able to tell whether a dropdown has a selected value or not. The problem is that selectedIndex, :selected, val(), etc. do return results for the following case: <select> <option value="123">123</option...

How to show an input after doing $ajax->observeField

Hi, I have a form with two inputs: echo $this->Form->input('articulo_id', array('empty'=>'---Select---')); echo $this->Form->input('numeral_id', array('empty'=>'---Select---', 'type'=>'hidden')); When the first one changes state the second one gets updated and auto-populated; this is how it gets updated: $options = array('url' => '...

Javascript: Function for an event

So I would like to create a function from this: element.onclick = function(e){ ... code ... } To something like this: element.onclick = doSomething(e); element2.onclick = doSomething(e); function doSomething(e){ ... code ... } In this way I could call the function multiple times but in this way e is not passed as an event...

Unable to use "class" methods for callbacks in JavaScript

I'm having a really rough time wrapping my head around prototypes in JavaScript. Previously I had trouble calling something like this: o = new MyClass(); setTimeout(o.method, 500); and I was told I could fix it by using: setTimeout(function() { o.method(); }, 500); And this works. I'm now having a different problem, and I thought ...

How to dynamically set focus to next text box in ui:repeat

I have one text box immediately after that one button. If i click on that button dynamically i get one more text box, but the focus is not coming to new text box. Can any one suggest something. Thanks in advance Venkat ...

How do you use the search method in javascript in an if statement?

I have an if statement that I want to execute if a certain variable does not have the <br/> element in it. How would you do this? I tried var str = "hello<br/>goodbye"; if( str.search("<br/>") == false) { //execute certain code } but this did not work. ...

How to check user entrance and exit URL

Hi, I've looked at a couple different analytics programs (like Google Analytics) that will tell me what URL my users have entered my site from, and which URL they are going to when they exit. It certainly must be possible to gather this data somehow, I just can't find any code examples of how to do it. I would imagine that it involves...

Jquery ui autocomplete - multiple sources

Hi. For 1 source this is the correct code after the ajax call: url: "links2.xml", I would like the source to be multiple xml files. How do I include the extra paths? Thanks. ...

Window.location Working But Not everywhere

var where_to = confirm("You have locked this record. You can only leave by clicking cancel."); if (where_to== true) { alert(window.location); window.location.href = window.location; } else { window.location.href = window.location; } This function works in IE 7 and firefox and opera 10.6. What it does is not allow a different page...