window.addEventListener('unload', function(e)
{
MyClass.shutdown();
window.removeEventListener('unload', /* how to refer to this function? */);
}, false);
Hi all!
I'm making a calendar generator in JavaScript. I need the Unix Timestamp for easter day midnight, for a given year. Can anyone tell me how I need to do that (in JavaScript)?
Thanks in advance.
PHP's function can be found here: http://www.php.net/easter%5Fdate
I want to check server response in javascript. For example I have a server A which will host the script. On excuting the script it will check if the server B is responding or not. If yest continue other wise redirect to server C. Is this possible with Javascript/Jquery? If not what could be a possible solution in PHP?
Is there an equivalent in Javascript to the C function strncmp? Strncmp takes two string arguments and an integer length argument. It would compare the two string up to length and determine if they were equal as far as length went.
Does javascript have an equivalent built in function?
i want to submit a form via ajax javascript to cakephp function.
cakephp function accepts $this-data, so i want to convert html form datas to cakephp function acceptable format i.e $this-data(array)...
how to do this in javascript(jquery)
I need to getting the client ip address using javascript.Actually,our connection provider ip is something like this 122.172.127.200.We are putting different private ip like 192.168.10.1,192.168.10.2 and so on..i can retrieve 192.168.10.1,but how can i retrieve the 122.172.127.200 using php or javascript.SSI already enabled.Please help me....Thanks
I want to display OpenOffice files, .odt and .odp at client side using a web browser.
These files are zipped files. Using Ajax, I can get these files from server but these are zipped files. I have to unzip them using JavaScript, I have tried using inflate.js, http://www.onicos.com/staff/iz/amuse/javascript/expert/inflate.txt, but without success.
How can I do this?
Today I was looking for website optimization content and I found an article talking about move JavaScript scripts to the bottom of the HTML page. Is this valid with W3C's recommendations?
I learned that all JavaScript must be inside of head tag...
Thank you.
I'm writing a web page in ASP.NET. I have some Javascript, and I have a submit button with an onClick event.
Is it possible to call a method I created in ASP with Javascript's onClick event?
Hi, I am wondering if there is aJavascript equivalent of php's parse_url. Currently, I wrote my a simple parser with regex; however, I would think that such function already exists in the in Javascript.
I have a string generated by php's json_encode() that looks like this:
[ { "key1":"value1",
"key2":"value2",
"key3":"value3"
},
{ "key1":"value1",
"key2":"value2",
"key3":"value3"
} ]
I use Javascript function to convert the string to Javascript object:
var jsonObj=JSON.parse(string);
How do I access the data inside since the inner objects have no names? I tried something like:
alert(jsonObj.firstChild.key1);
It gives me "undefined". Why is that so?
I have quite a number of user controls that I need to embed in Umbraco macros. Each user control has quite a bit of in page javascript that needs loaded into the page.
I have been building up the javascript with StringBuilder.Appendline then registering a startup script with code behind but this stinks and I feel there has to be a better way of going about this.
Has anyone any ideas please?
Thanks,
B
I was wondering if there was a way of adding javascript in every occurrence of a certain HTML tag, eg.
<td onmousedown="">
At the moment I just have it in every single one of my td tags in my table, but there must be a cleaner way. Something like adding javascript in the way CSS adds formatting.
Hi,
I would like to opena webpage and run ajavascript function from within a java app.
For example I would like to open the page www.mytestpage.com and run the following javascript code:document.getElementById("txtEmail").value="[email protected]";submit();void(0);
This works in a browser...how can I do it programatically?
Thanks!
Hello,
I am using the ExternalInterface to communicate between Flash and JavaScript using callbacks and the call method. I would like to throw an exception in ActionScript 3.0 and catch it in JavaScript and I was please wondering if there was anyway to do that?
Thank you very much,
Rudy
Is there a way to get a variable name as a string in Javascript? (like NSStringFromSelector in Cocoa)
I would like to do like this:
var myFirstName = 'John';
alert(variablesName(myFirstName) + ":" + myFirstName);
--> myFirstName:John
-- added
I'm trying to connect a browser and another program using JavaScript. I would like to send instance names from a browser to another program for callback method.
I want to parse a html-page that unfortunately requires JavaScript to show any content. In order to do so I use a small python-script that pulls the html-code of the page, but after that I have to execute the JavaScript in a DOM-context which seems pretty hard.
To make it even harder I want to use it in a server environment that has no X11-server.
Note: I already read about http://code.google.com/p/pywebkitgtk/ but it seems to need a X-server.
I'm using a classical javascript prototypal inheritance, like this:
function Foo() {}
Naknek.prototype = {
//Do something
};
var Foo = window.Foo = new Foo();
I want to know how I can improve this and why I can't use this model:
var Foo = window.Foo = new function() {
};
Foo.prototype = {
//Do something
};
Why this code doesn't work? In my head this is more logical than the classical prototypal inheritance.
Is there a way to test to see if javascript is enabled to ensure an application that required javascript is not initiated when it is disabled or otherwise not available?
I want to use Google Chart API using javascript. (I don't want to use the python wrapper)
So how do I send data from my python code into the javascript to create graphs?
I have aJavaScript function that loads a flash movie into a webpage div using swfobject.embedSWF().
I want to be able to, alternatively, load a .mov file into the same div, in the event that this is the file found instead of the .swf.
Is there a close equivalent to swfobject.embedSWF for the purposes of embedding a .mov file? If not, what is an efficient route to doing this using JavaScript?
I've just recently started programming, I was hoping for some help.
I have a drop down menu that was originally activated by click_event, however I want to now implement hoverIntent in order to make the menu drop.
The issue I am having now is being able to use the menu, because whenever I invoke the menu now, once I leave the area that activates the menu, the menu closes. If you could explain to me like I'm five, I'd appreciate it, thanks :)
The code I am using as follows:
JavaScript:
function setupUserConfigMenu() {
$('.user_profile_btn').hoverIntent(
function (event) {
$('#user_settings_dropdown').animate({height:['toggle', 'swing']
}, 225);
},
function (event) {
$('#user_settings_dropdown').animate({height:['toggle', 'swing']
}, 225);
})
}
HTML:
<li>
<a href="<%= "#" %>" class="user_profile_btn" title="Your profile page"><%= truncate(current_user.full_name || current_user.name, :length => 28) %>
<div class="arrow_down"></div></a>
<ul id="user_settings_dropdown">
<li>
<a href="<%= current_user.get_url(true) %>">
<%= image_tag current_user.get_thumb_url, :size => "30x30" %>
<div>
<%= truncate(current_user.full_name || current_user.name, :length => 40) %>
<br>
View profile
</div>
</a>
</li>
<div class="grey_line"></div>
<li class="settings_list_item">
<%= link_to "Settings", edit_user_registration_path %>
</li>
<li class="settings_list_item">
<%= link_to "About", "/about" %>
</li>
<li class="settings_list_item">
<%= link_to "Logout", destroy_user_session_path, :method => :delete %>
</li>
</ul>
</li>
I am creating one admin page where I have multiple textboxes.when I enter the userid in one textbox I want to display user name in next textbox when admin moves to next text box.for this I can use ajax or javascript? which one will be better?how can I do it through javascript.
Hi
I am am running some selenium tests(ruby) on my web page and as i enter an invalid characters in to a text box i have the JavaScript throw a alert like so
if(isNaN($(this).val()) || Number($(this).val().valueOf() <=0)){
alert("Please Enter A Number");
}
how can i handle this alert when its made and close the pop up?
i tried to use the wait_for_pop_up() and close() but i think that's only for browser pop up's and not JavaScript alerts.
any ideas?
thanks
(
function restoreURL() {
function turnLongURL(data) {
window.location = data.url;
}
var shortUrl = window.location.href;
var url = "http://json-longurl.appspot.com/?url=" + shortUrl + "&callback=turnLongURL";
var script = document.createElement('script');
script.setAttribute('src', url);
document.getElementsByTagName('head')[0].appendChild(script);
})();
code is above, but the firebug told me, turnLongURL is not defined
why is that?