javascript

Javascript CSS Woes - DOM Styling

Hey, I have the following as part of a script: // JSON object out into DOM Nodes, and appends them to 'searchResults' DIV) var amzJSONCallback = function(tmpData){ if(tmpData.Item){ var dv = cel('div'); var gDiv = getEl('searchResults'); gDiv.innerHTML=""; var tmpItem = tmpData.Item var ig = cel('img'); ig.setAttribute('s...

Apply javascript to pages like we apply css... wouldnt it be nice?

It just crossed my mind that it would be extremly nice to be able to apply javascript code like you can apply css. Imagine something like: /* app.jss */ div.closeable : click { this.remove(); } table.highlightable td : hover { previewPane.showDetailsFor(this); } form.protectform : submit { } links.facebox : click {} form.remote ...

jquery problem adding events on load

I'm having a problem getting a 'change' event to register with the following code var map = function(){ function addMapTriggers(){ $("#map_form select").change(getDataWithinBounds); } return{ init: function(){ getDataWithinBounds(); addMapTriggers(); } }; }(); and in a jquery document.ready $(function(){ map.i...

Bookmarklet: Load external site html

Hey guys, how can i load the html from an external site? (cross domain) ...

loading a element of same file through jquery

Hello, I have a file data.php, when a user clicks update the database is updated in background with jquery but in response i want to reload the particular table whose data was updated. my html: <div id="divContainer"> <table id="tableContainer" cellspacing='0' cellpadding='5' border='0'> <tr> <td>No.</td> <td>Username</td> <td>Pass...

Closing modal box with iframe Inside the iframe

Hey guys, I'm trying to programmatically close a Facebox modal with js that's called within the Iframe. That doesn't seem to work well with the Js DOM. http://famspam.com/facebox More generally, how would I close a generic modal that embeds an iframe with the code to close it inside the iframe. (sorry for the tounge(or eye) twisting...

ELEMENT.style.color not working in IE

In a small web application I'm setting some text in a text box and its color using JavaScript. In the following snipped, el is my object. This code produces the correct effects under Firefox, Opera and Safari but no such luck under IE. I've been searching without success since most examples say to use x.style.color="color", which I'm ...

Is there any way to set the search options per column in jqGrid 3.4.4?

So I'm using jqGrid with my mvc.net / Ling2Sql prototype site that I'm making and I've done the work to get jqGrids search functionality up and running. Its pretty sweet actually, but since you cant search by >, >=, < or <= with strings, I wanted to setup the search options per column. I know I can set the overall search options for th...

How can I read the page title of the parent page from an iframe?

I have a page that calls another page(on another server) and I want that page to read the title from the parent page. Is this possible or is there some security issue with this? ...

how can we resize a row in dojo grid

Hi all, I want to resize the dojo grid row by dragging it as we can do with the column. I want it some thing like Excel row which we can resize(minimize or maximize its height), is there a way to do this in dojo grid? Thanks Faz ...

What's the best and most efficient book to learn JavaScript?

What's the best and most efficient book to learn JavaScript? ...

Jquery fadeIn And fadeOut problem using hover over a div

I have this code: var x; x=jQuery(document); x.ready(inicializarEventos); function inicializarEventos() { var x; x=jQuery(".Caja2"); x.hover(entraMouse,saleMouse); } function entraMouse() { jQuery(this).fadeOut(); } function saleMouse() { jQuery(this).fadeIn(); } The problem is that when I move the mouse over t...

Encoding JSON for jQuery Calendar

Hi, I'm trying to use the PHP json_encode function to encode some JSON to send along to a jQuery plugin that will render out a calendar. The plugin's name is FullCalendar. I've started on grabbing event data from a MySQL database and encoding it in a JSON string, but I've run into a problem. The default JSON example that comes with the...

JQuery - AJAX load() method help

I need to get content from an external page and pass it as an argument to a function. I have looked into the url() method in the JQuery documentation but it seems it's only possible to use it to insert external content into div or some other HTML element. Basically what I need to do is: // I need to insert external page's content into ...

How does an anonymous function in JavaScript work?

Hello JS experts! I'm reading some posts about closures and see this stuff all over the places, but there is no explanation how does it works - just every time I'm told to use it...: // Create a new anonymous function, to use as a wrapper (function(){ // The variable that would, normally, be global var msg = "Thanks for visitin...

iPhone web apps running as native apps

The browser on the iPhone is capable of using advanced web technologies introduced in HTML5. One of these is the app cache that allows web pages to run on the client, from the cache, without a connection to the internet. Together with Local Storage you can also save data permanently "in" the page. My question is, would it then be possib...

Converting latitude and longitude to decimal values

I have GPS information presented in the form: 36°57'9" N 110°4'21" W I can use the javascript functions of Chris Veness to convert degrees, minutes and seconds to numeric degrees, but first need to parse the GPS info into the individual latitude and longitude strings (with NSEW suffixes). I have read related posts on stackoverflow, but...

What's the replacement for the .value variable in javascript?

I'm writing a page where I need to get the value attribute for the selected option within a select tag. The way I usually do it like this: onchange="changeCurrentWebsite(this.options[this.selectedIndex].value) However every time I use ".value" in Javascript my IDE(Intellij) complains that that symbol is deprecated... Does anybody know ...

how to add jquery in JS file

I have some code specific to sorting tables. Since the code is common in most pages I want to make a JS file which will have the code and all the pages using it can reference it from there. Problem is: How do I add jquery, and table sorter plugin into that js file? I tried something like this document.writeln('<script src="/javascri...

Can Prototype or JQuery return an HTTP status code on an AJAX request

url = "http://example.com" new Ajax.Request(url, { onComplete: function(transport) { alert(transport.status); } }); I'd like that to return a status of 200 if the site is working, or 500 if it is not working, etc.. But that code is returning 0 all the time. Ultimately, I want to have a setinterval function that regularly pings...