I am writing JavaScript code using Google Maps API.
map = new google.maps.Map2(document.getElementById("map_canvas"));
map.setCenter(new google.maps.LatLng(37.4419, -122.1419), 13);
The above code sets the default location of the map canvas to Palo Alto.
How can we write the script in such a way that the setCenter function automatic...
I'm trying to setup a full screen jquery slider. I've broken the project into two steps 1) css and 2) js.
1) CSS, below is a picture of what I'm shooting for (no fixed height) and below that is the code I have so far that doesn't work.
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<style type="text/cs...
How to add "Back to top" link at bottom at is browser window is shorter than page, using jquery?
<div id="mainContent">
<p>Some content</p>
</div>
If some content is bigger than browser window ( I mean if vertical bar comes on the page)
then i want to add Back to top just before closing the div.
<div id="mainContent">
<p>Some ...
I have an AJAX sample code from W3Schools, where if U request an AJAX call to remote server the request fails:
function loadXMLDoc() {
if (window.XMLHttpRequest) {
// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else {
// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTT...
What is the best way to give support nth-child in one shot to all IE version?
I want to give style like this. for some particular pages.
#products tr:nth-child(even) {
background-color: red;
}
#products tr:nth-child(odd) {
background-color: white;
}
...
I already used some script to implement the shortcuts in my web page
but i was wondering if could be possible to associate some combination not syncronic like Ctrl+X but more like a sequence typing 1..2..3 or any other combination to execute a script...
lets assume this example:
you have a long list with numbers:
you could type 3..5....
Possible Duplicate:
Javascript regex returning true.. then false.. then true.. etc
var r = /\d/g;
var a = r.test("1"); // will be true
var b = r.test("1"); // will be false
console.log(a == b); // will be false
Please explain to me why the result of r.test("1") alternates with each call?
I was able to work around the issue ...
I came over a snippet of code the other day that I got curious about, but I'm not really sure what it actually does;
options = options || {};
My thought so far; sets variable options to value options if exists, if not, set to empty object.
Yes/no?
Edit: changed title- thanks, Atomiton
...
I'm trying to calculate somebody's bowel health based on a points system. I can edit the data structure, or logic in any way. I'm just trying to write a function and data structure to handle this ability.
Pseudo calculator function:
// Bowel health calculator
var points = 0;
If age is from 30 and 34:
points += 1
If age is from 35 ...
I have a blog aggregator with many contributing blogs. I would like to distribute a snippet of javascript that contributors could place on their blogs. After placement the javascript would load a link and image that would point to the aggregator -- very much the same way that Google Adsense works but on a simpler and smaller scale.
Can...
I got a simple form and it works fine in ie but not working in firefox
onclick="login('loginuser','../private/loginuser.php?username='+email.value+'&pass='+passw.value,'loginresult');"
Any help appreciated.
...
function addOption(selectbox, val, txt){
......
}
addOption(list, "Cars", "Cars");
I need to add this in front of the text of the function:
So that there is space coming in before the option text...Never mind what it is for, it is just confusing... I just don't know how to insert it into the js code.
I...
<th>Prêmio</th>
<td colspan="11">
<div class="res"><img class="r1" src="img/x.gif" alt="Madeira" title="Madeira" />215 | <img class="r2" src="img/x.gif" alt="Barro" title="Barro" />193 | <img class="r3" src="img/x.gif" alt="Ferro" title="Ferro" />192 | <img class="r4" src="img/x.gif" alt="Cereal" title="Cereal" />202</div><div cl...
In mobile safari on iPhone or iPod Touch if a user clicks on a mailto link and then returns to the page (either send or cancel), timers no longer function inside of javascript. I've posted a bug to apple, and on openradar.
However, I was wondering if anyone out there has come across this before and come up with some sort of workaround....
Hello all,
I have tags in a html list, here is an example of two tags.
<div class="tags">
<ul>
<li>
<a onclick="tag_search('tag1');" href="#">tag1
<span class="num-active">1</span></a>
</li>
<li>
<a onclick="tag_search('tag2');" href="#">tag2
<span clas...
With some HTML like this:
<p>Some Text</p>
Then some CSS like this:
p {
color:black;
}
p:hover {
color:red;
}
How can I allow a long touch on a touch enabled device to replicate hover? I can change markup/use JS etc, but can't think of an easy way to do this.
...
I'm not quite sure how to put this, but here goes...
The css clip attribute is defined like so: rect(top, right, bottom, left). However, I'm exploring the use of a custom Rectangle 'class' to encapsulate some operations. The rectangle class has the attributes height, width and x, y.
The x and y values are encapsulated in a Point object...
http://stackoverflow.com/questions/1785762/how-to-add-a-full-sized-image-to-the-center-of-a-webpage-using-jquery/1787976#1787976
The code the guy posted...
...
what is the best method to clear text in a text field, when the user clicks on it...
i.e. if the text search field says "search" and when they click it, it clears the value..
thanks
...
I am using the following code in my sifr.replace() call, with the goal of changing the background on the replaced element.
onRollOver: function(fi) {
$(fi.getAncestor()).addClass("over");
},
onRollOut: function(fi) {
$(fi.getAncestor()).removeClass("over");
}
This works well in in firefox, but not in IE6. I am wond...