javascript

Opening and Closing Sized Popup Window Using SafariBrowserWindow Class

Hey -- Having great success using PhoneGap/HTML5 to develop basic iPad apps. However, I'm coming across something I can't quite crack, given my limited Javascript chops, and need help with ASAP. It's pretty simple functionality in the normal browser world -- I want to popup a window of a given width and height and simply have the abili...

Cancel navigation on a frame?

Say I have a frameset with a frame where Google is loaded. I want to prevent Google from navigating anywhere when the user click on a link or a button. Is this possible? ...

saving pagination

I have made a pagination for a list. The list contains links for different pages. What is the best way to to "save" the pagination "page" when user goes to different page and comes back to page where the pagination is the pagination gets resetted to page one. Save the current page to cookies or what? Any examples for saving pagination? ...

Prioritize changes in JavaScript code

I have acquired the task of updating some horribly outdated JavaScript code which I did not write, full of hacks and pitfalls, sparse in comments. In addition to making the change work, I'd like to make the script easier to understand and more robust (e.g. not using global variables). I think I've been able to wrap my mind around most ...

will destroying a jQuery dialog remove any handlers attached to elements inside it?

Hey Everyone, I've noticed some memory leaks in an app i'm building, after playing around with for a while FF will start to use up more and more memory (upwards to 1 000 000 k). I've done some research and found that if i do a $(selector).html(some stuff) to replace the contents of something the jQuery handlers from the elements p...

Get timezone difference between client and server

If my user is in California and they have their computer set to PST, it's 1:00 pm there. If my server is set to EST, the current server time is 4:00 pm. I need a way to get the timezone difference between the client and the server, either in Javascript or C#. In my example, I would get 3 (or -3, doesn't matter). Does anyone know how to...

Using the HTTP Accept Header from JavaScript

I have a web service that performs a database search. It accepts both GET and POST requests, and can return data in either JSON, CSV, or HTML format based on the HTTP Accept header. I have a web page that makes an Ajax request to this web service, and displays the search results. I have been asked to add a button to this page that will...

Javascript: Highlighting part of a string with <b> tags

I'm trying to highlight a match in a string by inserting <b> tags around the matching substring. For example, if the query is "cat" then: "I have a cat." should become: "I have a <b>cat</b>." Likewise, if the query is "stack overflow", then: "Stack Overflow is great." should become: "<b>Stack Overflow</b> is great." In other...

How can I access the contents of a frame or iframe with JavaScript or JQuery?

I'm trying $(document).ready(function(){ var myIFrame = document.getElementById("myIframe"); var content = myIFrame.contentWindow.document.body.innerHTML; alert( content ); }) but I get an access denied error I guess because what I have loaded in the frame is Google. Is what I want to do even possible? T...

Does YUI allow you to sort dates in a datatable?

Is there a way to sort dates in yui without having to define your own sorting implementation? ...

change <a> target to "_blank" depending on href

I'm trying to sort through the links on my page and make some of them open into a new window, depending on their URL. This is the code I have. It doesn't seem to be working. Can you see why? function MakeMenuLinksOpenInNewWindow() { var links = document.getElementsByTagName("a"); for (var i = 0; i < links.length; i++) { ...

Reading Iframe content to controller on ruby on rails

Hi there, I'm trying to do something like that:(ruby in rails) I got an Iframe with content of two text lines example: **"bla bla Http://tt.tt"** How I read this content of the Iframe and set them as two keys in session. example: *session['firstline'] = "bla bla" Session['secondline'] = "Http://tt.tt"* I try'd to get the content...

Javascript Overlay/Dialog Tracking with Google Analytics

Using javascript (jQuery to be precise in my case) I need to enable a dialog box to be tracked in Google Analytics as a unique page view, despite it being only a modal overlay. For context purposes I dont want the user leaving the page and the dialog content is loaded in via an ajax call. ...

How to select a tag with a variable value in jQuery

Hello Everyone, I am very new to jquery/javscript. I have a simple question. Lets say i have a tag like this: <Table id="mytable" > <Table> And i want to add some rows to this table. Then we do like: $("#mytable").append("<tr><td>value</td></tr>"); //some thing like this may not be having the right syntax Now my question is...

I can't figure out why a link seems to be returning false when clicked - will Console help?

I have a pop-up window in a web app that allows you to edit details of a job. You can also click a link to cancel/delete that job. But when I click that link right now after making some edits to it, nothing happens. It behaves as if javascript was targeting it with "return: false;" so it does nothing. The URL is correct. How can I check...

Pulling share thumbnail given URL from Facebook

Hello, I would like to pull the share site thumbnail from: http://www.facebook.com/share.php?u=my_website_url inside the tag <div class="UIThumbPager_Thumbs"> I would replace "my_website_url" with a given URL. Thank you! :) ...

java force literal when using escape character in jmeter

Running Jmeter on XP, I have the following scenario: Declare the variable "ServerName" with the value 'serverNameValue' Declare the a variable "TestResultsFolder" with the value 'c:\results\${ServerName}' ... do samplers ... Have a simple data writer save result to "${TestResultsFolder}\file" Unfortunately, The data writer is saving t...

Mootools cross domain, YQL proxy

Hello, I've been trying to make ajax cross domain scripting with YQL as proxy. It works great, but can i somehow change the data format? Im trying to extend the JSONP class like this: http://fragged.org/cross-domain-ajax-calls-via-yql-as-proxy-and-mootools-jsonp_1028.html And im getting data as text/html, but would like it to be as xm...

Can Chrome extension content scripts access window.opener?

In my extension, I'm trying to determine whether a new tab was created as a popup by another tab and if so, which tab. I thought I would be able to use window.opener from a content script to help figure this out. But it looks like window.opener doesn't work correctly in content scripts. When I create a tab manually, it's window.opener ...

jQuery .animate problem with Safari

Hi... Can anyone tell me why this doesn't work in Safari? var el = "#divName"; $(el).prepend($("<div id='" + id + "' style='position: absolute; top: -35px; width: 100%; height: 35px; clear: all;'></div>") .data("data", o) .html("<table style='width: 100%; height: 100%; position: absolute; top: 0px; lef...