javascript

How to get current System date in SmartGwt application

Hi All, How to get current system date in Smartgwt application (Merely javascript). I need date to be printed as 25 October 2010 something like this. Currently i am using the following code: String currentDate ; java.util.Date date = new Date(); String tempDate = date.toString(); String[] currDate = tempDate.split(" "); currentD...

regular expression for string that starts with 'http://'

Hi guys just like in the title - I need regular expression that will match anything that starts with 'http://' ...

Best practice: Javascript/Jquery saving variable for later use

Hello there, I'm sure, this question has been answered somewhere before but I just couldn't find it. If within a function a variable has been defined, what is the best practice to save it for later use? 1. Saving it "globally"? foo = 'bar';...function bar(){ ... foo = 'bat'; return foo; }... Here, the varia...

How to add 15 minutes to custom timer - Javascript

Hello, I've got this js: <script> $('#appt_start').val(parent.location.hash); $('#appt_end').val(parent.location.hash); </script> which gets the hash value from the url something.com/diary.php#0800 for example. The value is then used to autofill the start and end times in an appointment form. I need the second time (#appt_end) to b...

Send request to diff host from client browser

HI! for example i have site1.com Is it possible to send request from site1.com page witch loads in client browser, to other sites site2.com etc (i have no access to them) and parse result data? Is it possible to do it via javascript and how? ...

jQuery Datatables fnRender row change

Hi, I want to add some class to row when I render a table, sample code: $("#id").dataTable({ bProcessing: true, sAjaxSource: com.reelroles.path.api.message[component], aoColumns: [ {}, {}, { sWidth: "37px", fnRender: function(obj) { return "<span>" + myData + "</span>"; ...

How to debug Safari silently failing to connect to a secure WebSocket

When doing new WebSocket('ws://server/'); Safari connects fine, but when using new WebSocket('wss://server/'); it completely fails (returns a null object). Worse, it fails silently - no errors in traceback (a custom Eventlet web server) or in the error console within Safari. Chrome works fine with both the secure and non-secure host. H...

How can I go to history.back() when page loads?

Hi, I have a PHP page that has an error, but if I go back, it works fine. I can't redirect because the page can be accessed from two different places. How can I make a JavaScript that loads automatically when the page loads? Thanks, Sebastian EDIT that wouldn't work. is there a way to get the url of history.go(-2)? thanks, Sebastia...

javascript to display current options_for_select

Hi, I need to display the current selection for select table as a pop up box , where in index.rhtml I have this <SCRIPT LANGUAGE="JavaScript"> function checkData() { var myTest = formid.table_id.options[formid.table_id.selectedIndex].value; alert 'myTest'; } </script> <% form_tag :controller => 'project_controller', :action => 'actio...

jQuery delay with multiple selectors

Hi, I know you can do something like this: $('#item').fadeOut().delay(1000).fadeIn(); which will fade the element with the id of item out, then wait a second before fading it back in again. But is there a way to fade one item out and a different one back in with a delay inbetween. I've tried this but it didn't work: $('#item1').fadeO...

Rhino: Prototype chaining not working for host objects?

Invoking on a child a method defined in parent, where parent is a host object, gives EcmaError: method called on incompatible object. Host object defined in Java: public class HostObject extends ScriptableObject { public HostObject() {} @Override public String getClassName() { return "HostObject"; ...

safari javascript issue

attached javascript does not work in safari. this script displays a confirmation message before navigating away from the current page. surprisingly this works for the first time in safari (but not during subsequent submit). Scenario: user makes some changes and press submit button confirmation message displayed to user user decided ...

Can't find form on returned HTML

I have a main page consisting of a link and a div with id 'containerDiv'. When you press the link it loads some HTML from another page using Ajax into this div. The HTML that is returned contains a form. When the form is submitted, I wish to stay on the same page and display the resulting content in the div. Please see a picture showi...

How can I share HTML markup between two different HTML files?

Hi guys, I'm trying to build a simple extension for Opera 11 and I've hit a massive snag I'm sure most developers meet. In case you don't know, an extension in Opera is just another .html file, with some Javascript if you choose. What I'm having trouble with is getting the HTML source from the CALLING web page and passing it to the pop...

Is there a 'shorter' way to define a list of e.g. 100 new arrays?

Hi all, my aim is to compare the first names with the title of an img-element and insert the last name when the first name matches the title of the img-element. But before programming it, I'd like to ask you a question. Is there an easier way to create a new array list containing the first and the last name than I've chosen? It would b...

showing new window pop up to center

function open1() { window.open('http://www.pageresource.com/jscript/jex5.htm','ddsfa','width=400,height=200'); } Hello I want show this popup to center when click on "Hello" ...

JS embedded on other sites - how can I use jQuery without screwing up other jQuery installations?

I'm working on some JavaScript that will be embedded on other websites (think like Google Analytics or AdSense). There is some hardcore JS being done -- AJAX requests, animations, JSON(P). I've written the prototype using jQuery, and really want to keep using it, but this might cause a problem when embedded on the other sites if they al...

How to integrate a series of images to form an HTML page?

I have a series of images (named as image_1.jpg, image_2.jpg and so on) in a folder. How can all of the images be joined together to form an HTML page using Javascript? ...

SO: what does this js mean? I am studying SO source code...

(some code)(jQuery); What does this mean? (function (a) { function d(g) { return typeof g == "object" ? g : { top: g, left: g } } var b = a.scrollTo = function (g, e, f) { a(window).scrollTo(g, e, f) }; b.defaults = { axis: "xy", duration: parseFloat(a....

Send commands between two computers over the internet

I wish to control my computer (and usb devices attached to the computer) at home with any computer that is connected to the internet. The computer at home must have a program installed that receives commands from any other computer that is connected to the internet. I thought it would be best if I do this with a web interface as it would...