These are the logical steps which I need to do with jquery:
x is a 2 digit number(integer) derived from an input.value();
If var x is **not** 33 or 44
Convert this 2 digit number to string;
split the string in 2 parts as number;
Add these 2 values until they reduce to single digit;
Return var x value as this value;
Els...
I'm trying to create a simple game in javascript and I'm stuck on how to deal with keys.
Small example:
function keyUpEvent(event) {
alert(event.keyCode);
}
window.addEventListener("keyup", keyUpEvent, false);
I'm running Ubuntu 9.10 and testing it in Firefox 3.5 and Chromium.
If I press and release a button instantly I get an a...
Hi,
I haven't done much JavaScript. I am trying to compare two dates. From jconsole:
a = ["01/01/2010","01/02/2010","01/03/2010"]
date1 = new Date('01/02/2010')
Sat Jan 02 2010 00:00:00 GMT-0800 (PST)
date2 = new Date(a[1])
Sat Jan 02 2010 00:00:00 GMT-0800 (PST)
date1 == date2
false
Can someone tell me why this does not match?
...
hi :)
after an hour of trying to find a solution, I give up (temporarily). "this.selectedIndex = -1" clears all select element just fine in FF and other browsers, but NOT in Internet Explorer 8.
any idea how to clear select elements in IE?
thanks!
...
html
<a href="#" onclick="MyObj.startup()">click me</a>
js code
var MyObj =
{
startup : function()
{
var ajax = null;
ajax = new XMLHttpRequest();
ajax.open('GET', 'http://www.nasa.gov', true);
ajax.onreadystatechange = function(evt)
{
if(ajax.readyState == 4)
{...
I searched a lot on this topic, but didn't really found a solid answer
to this.
I need to set a cookie from any domain (out of my control),
lets say "Domain B" to my main domain, lets say "Domain A", and be able
to read the cookie also, without exiting Domain B. kinda like Facebook
connect for websites, or Snap.com, and others of the ...
I have created a dynamic table whose rows gets appended by click of the "Add" button, i want the user not to be able to submit the page if no value is entered in all the rows of the table.
how do i achieve this
The code is
<html>
<head>
<script type="text/javascript">
function addRowToTable()
{
var tbl = document.getElementById('tb...
I need a javascript to replace i into I. This should apply to cases such as
i'm good.
So am i.
He though i love him.
The standard ThisContent = ThisContent.replace("i", "I"); doesn't work because it replaces every i. I also thought of ThisContent = ThisContent.replace(" i ", " I "); but it doesn't work for the first and second case....
Given the following xml
<rss>
<channel>
...
<pubDate>20/30/2099</pubDate>
...
<item>
...
<pubDate>10/30/2099</pubDate>
...
</item>
...
<item>
...
<pubDate>40/30/2099</pubDate>
...
</item>
...
</channel>
</rss>
how would I efficiently access pud...
Hello all:
Please go here to see an iframe based web app.
Click on the map of Australia, choose a city, then buy some tickets.
Now you will see the cart form located on the lower right corner.
The problem is in IE8, I cannot delete checked rows from the table;
whereas in other browsers such as FireFox3.6, Opera10, Safari4 and Chrome4, t...
just wondering if anyone knows anything of using javascript to set html to new content instead of linking to new pages, if this is generally a bad idea or if it kind of hurts SEO(which im kind of new to)
Basically the home page displays given content, and the links to like contact pages and stuff, just change the body content to what wo...
Hi,
Can someone explain this to me. From jconsole ...
from = new Date('01/01/2010')
Fri Jan 01 2010 00:00:00 GMT-0800 (PST)
thru = new Date('06/07/2010')
Mon Jun 07 2010 00:00:00 GMT-0700 (PST)
(thru - from) / (1000 * 24 * 60 * 60)
156.95833333333334
Why don't I get a whole number of days? How do I calculate the difference between ...
A friend and I had an argument last week. He stated there were no such things as classes in Javascript.
I said there was as you can say var object = new Object()
he says "as there is no word class used. Its not a class.
-- Whats your take on it guys?
thanks.
...
I have a $.get() call to a PHP page that takes 4 GET parameters. For some reason, despite giving the $.get() call all 4, it only passes the first two. When I look at the dev console in chrome, it shows the URL that gets called, and it only passes action and dbname. Heres the code:
$.get('util/util.php', { action: 'start', dbname: db, ur...
I want to expand the Node only on click on Icon not on the label.
With yahoo ui 2.7 :
selfCategoryTree.tree.subscribe("labelClick", function(node) { alert(node.data.customData.id + " label was clicked"); });
So I catch the labelClick , I show an alert, but the Node is expanded.
EDIT:
I do this :
tree.subscribe("clickEvent", TreeO...
I wrote a blog post a while ago detailing how the availability of both primitive and object-wrapped value types in JavaScript (for things such as Number, String and Boolean) causes trouble, including but not limited to type-casting to a boolean (e.g. object-wrapped NaN, "" and false actually type-cast to true).
My question is, with all ...
Different pages of my site have different js needs (plugins mainly), some need a lightbox, some dont, some need a carousel, some dont etc.
With regards to pageloading speed should i
option 1 - reference each js file when it is needed:
so one page might have:
<script type="text/javascript" src="js/carousel/scrollable.js"></script> ...
I have a form and I would like the ACTION field to be different depending on the button pressed.
For instance the form might get processed by different PHP files if I press button A or button B.
How can I do this?
Thanks!
...
I am trying to create a Exception class to get and send errors from client to server. I want to catch exception in javascript function and push the details to the web service to write to database.
But i couldn't get how to get which function/line throwed this exception. Is there any way to solve this?
...
Hello,
Does someone knows how can I change the container for my drop down box?
I have 3 "TD" tags and I would like to move the drop down between them, using client side code.
TY
...