switch multiple images on click - javascript

I have the code to switch an image back and forth and it works fine. However, I was wondering if there was a way to rewrite the script so I can use it in multiple places. This is my code currently:
function swaparrows(obj) {
var x=document.images
if (x[0].src.match('images/editloadout.png')) {
x[0].src="images/editloadoutopen.png";
}
else if (x[0].src.match('editloadoutopen.png')) {
x[0].src="images/editloadout.png";
}
}
<img src="images/editloadout.png" onclick="swaparrows()" />
which works for this one specific instance only. I would like it to work in multiple places with different pictures entirely.

Pass the two images in to the swap function, and use the actual clicked object's src:
function swaparrows(obj, i1, i2) {
var src = obj.getAttribute('src');
if (src.match(i1))
obj.setAttribute('src', i2);
else
obj.setAttribute('src', i1);
}
where the HTML is:
<img src="images/editloadout.png"
onclick="swaparrows(this, 'images/editloadout.png', 'editloadoutopen.png')" />
example: http://codepen.io/paulroub/pen/GoEBF

So you could use a case switch and decide based on the sender ID
Reference:http://www.w3schools.com/js/js_switch.asp
example:
function swaparrows(idTag) {
var ele = document.getElementById(idTag);
switch(idTag){
case("editLoadout"):
if (ele.src.match('images/editloadout.png')) {
ele.src="images/editloadoutopen.png";
}
else if (ele.src.match('editloadoutopen.png')) {
ele.src="images/editloadout.png";
}
break;
case("button2"):
if (ele.src.match('images/button2.png')) {
ele.src="images/button2open.png";
}
else if (ele.src.match('button2open.png')) {
ele.src="images/button2.png";
}
break;
}
}
<img id="editLoadout" src="images/editloadout.png" onclick="swaparrows('editLoadout')" />
<img id="button2" src="images/button2.png" onclick="swaparrows('button2')" />

Why not just use css and let javascript do more important stuff?
replace the background-color with background-image or whatever
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Switch</title>
<style>
.i{
width:32px;line-height:32px;
display:block;float:left;
text-align:center;
background-color:white;
}
.i:target{
background-color:green;
}
</style>
</head>
<body>
<a class="i" id="a" href="#a">a</a>
<a class="i" id="b" href="#b">b</a>
<a class="i" id="c" href="#c">c</a>
<a class="i" id="d" href="#d">d</a>
<a class="i" id="e" href="#e">e</a>
</body>
</html>
another approach is to set a js var with the current selected item and toggle the class of that.if you want an example just ask.any other questions just ask.
.. there are many ways to to what you want, your approach is not a good one.

Related

Update html image via javascript functions

I'm fairly new to javascript, and getting quite frustrated by the following code
<!DOCTYPE html>
<html>
<script>
var time = '0'
var area = 'neast'
function update_area(input) {
area = input;
load_updated_image(area,time);
};
function update_time(input) {
time = input;
load_updated_image(area,time);
};
function load_updated_image(area,time) {
var url = 'http://personal.psu.edu/kps5442/modelimages/hrrr_'+area+'_wetbulb'+time+'.png';
document.getElementById("theImage").src = url;
document.getElementById("url").innerHTML = url;
};
</script>
<body onload="load_updated_image(area,time)">
<p>URL Output:</p>
<p id="url"></p>
<font size = 4><b>Forecast Hour: </b>
<font size = 3>
<a href="#" onmouseover="update_time(0);" /> 00</a>
<a href="#" onmouseover="update_time(1);" /> 01</a>
<a href="#" onmouseover="update_time(2);" /> 02</a>
<img id="theImage" src=undefined width="850" height="600" />
<br> <font size = 4><b>Region Selection: </b>
<a href="#" onclick="update_area(neast);" /> Northeast</a>
<a href="#" onclick="update_area(seast);" /> Southeast</a>
</body>
</html>
I have 18 different "hours" of images for different regions across the US. The goal is to change the hour of the image when the hour links are moused over, and update the region when the region links are clicked.
The function update_time() works as expected, changing the image as I mouse over the links. However, the function update_area() fails with the following error:
"Uncaught ReferenceError: neast is not defined"
I'm not sure why this is happening, because the update_time and update_area functions are built in exactly the same way, and I globally defined the time and area variables at the start of the script.
Any help would be appreciated!
You have to put the arguments in quotes .
onclick="update_area('neast');"
onclick="update_area('seast');"
<!DOCTYPE html>
<html>
<script>
var time = '0'
var area = 'neast'
function update_area(input) {
area = input;
load_updated_image(area,time);
};
function update_time(input) {
time = input;
load_updated_image(area,time);
};
function load_updated_image(area,time) {
var url = 'http://personal.psu.edu/kps5442/modelimages/hrrr_'+area+'_wetbulb'+time+'.png';
document.getElementById("theImage").src = url;
document.getElementById("url").innerHTML = url;
};
</script>
<body onload="load_updated_image(area,time)">
<p>URL Output:</p>
<p id="url"></p>
<font size = 4><b>Forecast Hour: </b>
<font size = 3>
<a href="#" onmouseover="update_time(0);" /> 00</a>
<a href="#" onmouseover="update_time(1);" /> 01</a>
<a href="#" onmouseover="update_time(2);" /> 02</a>
<img id="theImage" src=undefined width="850" height="600" />
<br> <font size = 4><b>Region Selection: </b>
<a href="#" onclick="update_area('neast');" /> Northeast</a>
<a href="#" onclick="update_area('seast');" /> Southeast</a>
</body>
</html>
In JavaScript variables are not restricted to a single 'type', but a String will always be contained in quotes and a number will not. Also a variable cannot be, or start with, a number. This is why when you use a string as an argument it must be contained within quotes, otherwise it thinks you are sending a variable.
You're starting your document with <!doctype html> so you're saying you're writing HTML5, but there is a whole bunch of things that are incredibly wrong here due to use HTML3.2 and obsolete ways to invoke javascript.
Under modern HTML5 rules, there are no self-closing elements. It's not a hard error, but don't add that /> at the end of an <img.... Also <font> hasn't existed as element for 20 years now. It was removed in HTML4.1 in 1998. Then some semantics: if you need button functionality (i.e. clickable, but NOT navigating to some (part of a) page), use <button>. That's what it's for. Do not use <a>, and definitely not with href="#", because that's an active instruction for the browser to scroll to the top of the page. Finally, on...=... handlers are an ancient attribute that is unfortunately still supported, but you should never use. Use addEventListener in your Javascript, after you've declared all your HTML.
So let's just fix everything at the same time:
<!-- this line literally tells the browser "I am using HTML5" -->
<!DOCTYPE html>
<html>
<!-- always have a header section -->
<head>
<!-- no / at the end of meta elements -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>Always just fill this in, it's good practice</title>
<style>
/* you want this in its own file, see the note at the end of this post */
h1 {
font-size: 100%;
font-weight: bold;
}
</style>
</head>
<body>
<!-- sectioning isn't mandatory, but extremely good practice -->
<section id="output">
<h1>URL Output:</h1>
<p>Forecast Hour:</p>
<div class="controls">
<!-- let's use data attributes, and be explicit about the values here -->
<button class="forecast update" data-value="0">0h</button>
<button class="forecast update" data-value="1">1h</button>
<button class="forecast update" data-value="2">2h</button>
</p>
<!-- if you've never see the figure/figcaption elements: they exist -->
<figure id="forecast-image">
<!-- no / at the end of this element -->
<img src="placeholder.jpg" width="850" height="600" alt="forecast map">
<figcaption></figcaption>
</figure>
</section>
<section>
<h1>Region Selection</h1>
<div class="controls">
<button class="area update" data-value="neast">Northeast</buton>
<button class="area update" data-value="seast">Southeast<button>
</div>
</section>
<!-- don't put your script in the page. put it in its own file -->
<script src="updates.js"></script>
</body>
</html>
And then we make a second file for the javascript called updates.js:
// this goes last, so that the DOM is done by the time you invoke your script.
var currentTime = 0;
var currentArea = `NorthEast`;
// this function doesn't need parameters: we already know what they are
function load_updated_image() {
var url = `http://personal.psu.edu/kps5442/modelimages/hrrr_${currentArea}_wetbulb${currentTime}.png`;
let figure = document.getElementById(`forecast-image`);
// update the image
let img = figure.querySelector(`img`);
img.src = url;
// update the image caption with a link
let caption = figure.querySelector(`figcaption`);
caption.innerHTML = ``;
let link = document.createElement(`a`);
link.href = url;
caption.appendChild(link);
}
// update the area, and called image update
function update_area(area) {
currentArea = area;
load_updated_image();
};
// update the time, and called image update
function update_time(time) {
currentTime = timel
load_updated_image();
};
// add the initial page load handling
document.addEventListener(`ready`, evt => load_updated_image());
// add the click handling for forecast time buttons
let forecastButtons = document.querySelectorAll(`button.forecastupdate`);
forecastButtons.forEach(button => {
// get the button's data-value
value = button.dataset.value;
// and then set up a click listener to update the forecast time
button.addEventListener(`click`, evt => update_time(value));
});
// add the click handling for forecast area buttons
let areaButtons = document.querySelectorAll(`button.area.update`);
forecastButtons.forEach(button => {
// get the button's data-value
value = button.dataset.value;
// and then set up a click listener to update the forecast area
button.addEventListener(`click`, evt => update_area(value));
});
And then to be even more proper, don't use <style>...</style> but make a new file called "forecast.css" and then link to that in your page using <link href="forecast.css" rel="stylresheet"> (note: this is still HTML5, you don't put /> at the end. Link elements simply don't have a closing tag)

html checkbox list that shows and hides links when filtered

I have written code that creates a checkbox list where when i click the checkbox below my list of options i would like a link to show underneath that the user can click (show/hide) I cannot figure out why my code will not work. If the user unchecked the box the link disappears but nothing happens when i click my check boxes. I would like to do this fix in JQuery
<!DOCTYPE html>
<html>
<div class ="container">
<head></head>
<body>
<input id="grp1" type="checkbox" value="group_1" onClick="http://google.com" />
<label for="grp1"> group 1 </label>
<div>
<input id="grp2" type="checkbox" value="group_2" onClick="http://google.com" >
group_2</label>
</div>
</body>
</html>
You'll have to use javascript to hide/show the wanted elements in html. There are many approaches to this. The most basic one would be something like
<!DOCTYPE html>
<html>
<body>
<div id="container">
<input id="grp1" type="checkbox" value="group_1"/>
<label for="grp1"> group 1 </label>
<br>
<input id="grp2" type="checkbox" value="group_2"/>
<label for="grp2"> group_2</label>
<!--hidden elements using css-->
Link for group_1
<br>
Link for group_2
</div>
<script>
//listen to the click event on the whole container
document.getElementById("container").onclick = function (e) {
//check every box if it's checked
if (document.getElementById('grp1').checked) {
document.getElementById('url1').style.display = 'block';
} else {
document.getElementById('url1').style.display = 'none';
}
if (document.getElementById('grp2').checked) {
document.getElementById('url2').style.display = 'block';
} else {
document.getElementById('url2').style.display = 'none';
}
}
</script>
</body>
</html>
Of course you can use different approaches like creating the element in javascript then adding it to the html if you don't like the idea if existing hidden elements. You might also use loops to loop through checkbox element and simply show/hide the url accordingly. And more to make the code flexible on any number of boxes. Something like this
<!DOCTYPE html>
<html>
<body>
<div id="container">
<div id="checkBoxContainer">
<input id="grp1" type="checkbox" value="group_1"/>
<label for="grp1"> group 1 </label>
<br>
<input id="grp2" type="checkbox" value="group_2"/>
<label for="grp2"> group_2</label>
</div>
<!--hidden elements using css-->
Link for group_1
<br>
Link for group_2
</div>
<script>
//listen to the click event on the whole container
document.getElementById("checkBoxContainer").onclick = function (e) {
var linkNumber = 1; //This is number of the first url element with ud url1
var containerChildren = document.getElementById("checkBoxContainer").children;
//loop through the children elements
for (var i = 0; i < containerChildren.length; i++) {
var oneChild = containerChildren[i]; //catch only one child in a variable
//simply filter the input elements which are of type checkbox
if(oneChild.tagName === "INPUT" && oneChild.type === "checkbox"){
//Show or hide the url accordingly.
if (oneChild.checked) {
document.getElementById('url' + linkNumber++).style.display = 'block';
} else {
document.getElementById('url' + linkNumber++).style.display = 'none';
}
}
}
}
</script>
</body>
</html>
The onclick HTML attribute doesn't work that way. The attribute value is executed as javascript. You can make a js function to show/hide the link.
Hi you want to try this:
<!DOCTYPE html>
<html>
<head>
<style type="text/css">
.group-link{
display: block;
}
.hidden{
display: none;
}
</style>
</head>
<body>
<div class="jsParent">
<label for="grp1">
<input id="grp1" type="checkbox" value="group_1" onchange="showLink(this)"/> group 1
</label>
<a class="group-link hidden jsLink" href="https://www.animalplanet.com/tv-shows/dogs-101/videos/the-doberman">Group 1 Link</a>
</div>
<div class="jsParent">
<label for="grp2">
<input id="grp2" type="checkbox" value="group_2" onchange="showLink(this)"/> group_2
</label>
<a class="group-link hidden jsLink" href="https://www.animalplanet.com/tv-shows/cats-101/videos/ragdoll">Group 2Link </a>
</div>
<script type="text/javascript">
function showLink(el){
var parent = el.parentElement.parentElement;
var linkEl = getAnchorEl(parent);
if(linkEl){
if(el.checked){
linkEl.classList = linkEl.classList.value.replace('hidden', '');
}else{
linkEl.classList = linkEl.classList.value + ' hidden';
}
}
}
function getAnchorEl(parent){
var childrens = parent.children;
var linkEl = null;
for (var i = 0; i < childrens.length; i++) {
var childEl = childrens[i];
if(childEl.classList.value.indexOf('jsLink') > -1){
linkEl = childEl;
break;
}
}
return linkEl;
}
</script>
</body>
</html>
Your question is undoubtedly a duplicate but I am answering because I would like to help you identify issues with the code you posted.
I notice you have a <div>tag between your tag and tag. Why? This is a bit of an over simplification but as a general rule never put anything between your <html> and <head> tag and only place <div> tags inside your <body> tag. Also be mindful of how you nest your elements. That tag starts after and before .
Even if that were correct placement you close the before you close your div arbitrarily in the middle of your body tag. you should never have
<div>
<p>
</div>
</p>
Instead it should look like this
<div>
<p>
</p>
</div>
In your onClick attribute you have a random URL. That will not open a new window. You new too put some javascript in there.
<input onClick="window.open('http://google.com')">
Also your second label tag does not have an opening, just a </label> close tag
To answer your question - I suggest you look at the jQuery toggle function.
<input type="checkbox" id="displayLink" />
Google
<script type="text/javascript">
$("#displayLink").click(function(){
$("#googleLink").toggle();
});
</script>
As a general rule you should favor event handlers (such as the $("").click() posted above) to handle events (like clicking) as opposed to html attributes such as onClick.

Javascript Performance for Dynamic Image Resouce?

I wrote an HTML page that supposed to switch fast between two pictures.
In the result I can see that the first picture is freezed for about a minute and JUST then they start to flip over fast and nicely. It is as if the first picture is loaded quickly and the second takes more time (they have quite the same size)
What can explain this behavior?
What should I do to make them flip from the very beginning?
Code:
<head>
<title>Visualize</title>
<script src="jquery-3.1.0.min.js"></script>
<script>
$(document).ready(function()
{
var file = "a";
setInterval(function()
{
$('.canvas').attr("src","images/"+ file +".png");
file = flipFile(file);
}, 290);
});
function flipFile(file)
{
if(file=="a")
{
file="b";
}
else if(file=="b")
{
file = "a";
}
return file;
}
</script>
</head>
<body>
<div class="container">
<img class="canvas" src="/images/file.png">
</div>
</body>
Two things I did
Placed <img> tag for each picture I want to deal with (with Display:None, for having them not visible)
Added "onload" attribute to the body that triggers the funciton that changes visibility between pictures.
This way the page waits for them to get loaded and just then starts the functionality.
`function visualize()
{
$('.loading').fadeOut(1000);
$('.blanket').fadeIn(1000);
setInterval(function()
{
$('.i'+fileIdx).show();
$('.i'+filePrevIdx).hide();
filePrevIdx = fileIdx;
fileIdx = addCyclic(fileIdx);
}, 290);
}`
`<body style="background-color: black;" onload="visualize()">
<div class="container">
<div class = "blanket" style="display: none;"></div>
<div class="loading">
Loading...
</div>
<img class="i1" src="./images/1.png" style="display: none;">
<img class="i2" src="./images/2.png" style="display: none;">
<img class="i3" src="./images/3.png" style="display: none;">
<img class="i4" src="./images/4.png" style="display: none;">
</div>
</body>`

get source of click in javascript?

I'm designing a webpage which uses very basic javascript.
Here's the code:
html:
<!DOCTYPE html>
<html>
<body>
<img id="apple" onclick="display()" src="images/apple.jpg" width="150" height="150">
<img id="pineapple" onclick="display()" src="images/pineapple.jpg" width="130" height="210">
<br><br>
<div id="description" style="width:300px;height:100px;border-top: 1px solid #000; border-bottom: 4px solid #000; border-left: 2px solid #000;
border-right: 4px solid #000;padding: 5px;"></div>
<br>
<button type="button" onclick="reset()">Reset</button>
<script type="text/javascript" src="obst.js"></script>
</body>
</html>
Here's the javascript:
function display()
{
document.getElementById("description").innerHTML="der Apfel - Apple<br>die Äpfel - Apples<br><br>Ein Apfel am
Tag hält den Arzt weg<br>- An apple a day keeps the doctor away";
}
function reset()
{
document.getElementById("description").innerHTML="";
}
Clicking on the image of the apple displays text in the description box. Clicking on the image of the pineapple displays some other text in the same place.
Instead of using different functions like apple(), pineapple() to insert text, I thought it would be easier to call a display function whenever something is clicked, and in the display function, if the script could identify the source of the click (that is, which image is clicked), it could insert text accordingly.
How do I go about this identifying the click source?
You can use this.id:
<img id="apple" onclick="display(this.id)" src="images/apple.jpg" width="150" height="150">
<img id="pineapple" onclick="display(this.id)" src="images/pineapple.jpg" width="130" height="210">
then catch the id:
function display(clicked_id)
{
alert(clicked_id);
}
You would pass this to the display() handler, then you can access the properties of the DOM element that received the click. Here is the fiddle: http://jsfiddle.net/dandv/BaNdS/. Essentially,
<img id="apple" onclick="display(this)" ... >
<img id="pineapple" onclick="display(this)" ... >
<script type="text/javascript">
function display(self) {
alert(self.id);
}
</script>
There is a easier way. Use a variable:
function selectFruit(fruit){
if(fruit == 'apple'){
.....
}else if(fruit == 'pinapple'){
.....
}
...
}
I would go in a somewhat different direction:
For each possible "term" have hidden block of text with the desired contents.
In each image tag add the ID of its proper placeholder as a rel attribute.
Have JavaScript running on page load, assigning the click event automatically.
Sample HTML would be:
<img id="apple" src="images/apple.jpg" rel="desc_Apple" width="150" height="150" />
<img id="pineapple" src="images/pineapple.jpg" rel="desc_Pineapple" width="130" height="210" />
<div class="item_placeholder" id="desc_Apple">
der Apfel - Apple<br>die Äpfel - Apples<br><br>Ein Apfel am
Tag hält den Arzt weg<br>- An apple a day keeps the doctor away
</div>
<div class="item_placeholder" id="desc_Pineapple">
der Apfel - Pineapple<br>die Äpfel - Pineapples<br><br>Ein Apfel am
Tag hält den Arzt weg<br>- An Pineapple a day keeps the doctor away
</div>
Don't forget CSS to make those hidden:
.item_placeholder { display: none; }
And finally the magic to bind them all:
window.onload = function() {
for (var i = 0; i < document.images.length; i++) {
var image = document.images[i];
var rel = image.getAttribute("rel");
if (rel && rel.length > 0) {
image.onclick = ItemImageClick;
}
}
};
function ItemImageClick() {
var rel = this.getAttribute("rel");
var placeholder = document.getElementById(rel);
if (placeholder) {
document.getElementById("description").innerHTML = placeholder.innerHTML;
} else {
alert("DEBUG - element not found " + rel);
}
}
Live test case.
Probably the simplest way:
var code, node = document.getElementById('description');
code = {
apple : "Apple",
pineapple: "Pineapple"
};
function display( src ) {
node.innerHTML = node.innerHTML ? "" : code[ src.id ] ;
}​
for ( var i in code ) {
document.getElementById( i ).onclick = function() { display( this ) };
}
Demo on jsFiddle
Simple and easy solution: pass arguments to the display function:
<img id="apple" onclick="display('apple');" …>
<img id="pineapple" onclick="display('pineapple');" …>
Better solution: Use the javascript-only (no JS in HTML markup) traditional or even the advanced event handling model. The listeners (which might be attached to multiple elements) will get passed an event object, from which you can determine which element was clicked. Example:
function clickHandler(eventObj) {
var elem = eventObj.target;
if (elem.nodeName.toLowerCase() == 'img' && elem.id)
display(elem.id);
}

Javascript method for rotating images on a mouse click

I have a PHP-page with a series of pie chart images (I use Google Chart Tools) all of the same 700x280 size:
<html>
<head>
<script>
var chart1 ='http://chart.apis.google.com/chart?cht=bhg&chs=700x280&chd=s:el,or&chco=4d89f9,c6d9fd';
var chart2 ='http://chart.apis.google.com/chart?cht=bhg&chs=700x280&chd=s:el,or&chco=4d89f9,c6d9fd&chbh=15,4,15';
var chart3 ='http://chart.apis.google.com/chart?cht=bvg&chs=700x280&chd=s:hello,world&chco=4d89f9,c6d9fd&chbh=15,4,15';
XXX please suggest a function here XXX
</script>
</head>
<body>
<img src="logo.png" width=700 height=280>
Chart 1:
<img src="http://chart.apis.google.com/chart?cht=p&chd=s:Uf9a&chs=700x280&chl=January|February|March|April" width=700 height=280>
Chart 2:
<img src="http://chart.apis.google.com/chart?cht=p&chd=s:Uf9a&chs=700x280&chdl=May|Juny|July|August" width=700 height=280>
Chart 3:
<img src="http://chart.apis.google.com/chart?cht=p&chd=s:Uf9a&chs=700x280&chl=September|October|November|December" width=700 height=280>
</body>
</html>
I would like to offer users the possibility to view the same data as a bar chart - when they click on a chart.
Last time I've used Javascript it had been for MSIE4 and Netscape. Please give me some pointers for my little function.
I.e. I don't need any help with constructing Google Charts, I just need little help on the Javascript function to rotate images in-place, on a mouse click, but with the following requirements:
1) Users with Javascript disabled should be still able to see the pie charts. Also it would be nice to enable them to see the bar charts too (i.e. by putting bar charts behind an HTML-link or maybe you hide the bar charts with Javascript and for users with Javascript disabled they are not hidden - which is okay).
2) Please 1 universal function for all charts - i.e. I don't want to have 10 functions for 10 charts.
Thank you very much! Alex
Realizing it's ages since I wrote any javascript without a framework (you forgot to mention if you were using one.. You probably should!). Anyway, here's my stab at it. People without Javascript can hover the pie charts to see the bar charts, while people with Javascript can click on them.
<style type="text/css">
img.primary { display: inline; }
img.secondary { display: none; }
div.foo:hover img.secondary { display: inline; }
div.foo:hover img.primary { display: none; }
</style>
<script type="text/javascript">
function swapImages(container)
{
for(var child in container.childNodes)
{
child = container.childNodes[child];
if(child.nodeName == "IMG")
child.className = child.className == "primary" ?
"secondary" : "primary";
}
}
window.onload = function() {
// Remove the foo class when the page loads, to disable hover
var chartArea = document.getElementById("chartArea");
for(var child in chartArea.childNodes)
{
child = chartArea.childNodes[child];
if(child.nodeName == "DIV" && child.className == "foo")
child.className = "";
}
}
</script>
<div id="chartArea">
<div class="foo" onclick="swapImages(this);">
<img class="primary" src="http://somewhere/piechart1.png" />
<img class="secondary" src="http://somewhere/barchart1.png" />
</div>
<div class="foo" onclick="swapImages(this);">
<img class="primary" ... />
<img class="secondary" ... />
</div>
<div class="foo" ....>
</div>
If you can live with the image changing on hover instead of on click, you may not need any JavaScript...
<style type="text/css">
/*<[CDATA[*/
a.chart,a.chart:hover{
cursor:default;
display:block;
background-repeat:no-repeat;
width:700px;
height:280px;
}
#chart1{background-image:url(http://chart.apis.google.com/chart?cht=p&chd=s:Uf9a&chs=700x280&chl=January|February|March|April);}
#chart1:hover{background-image:url(http://chart.apis.google.com/chart?cht=bhg&chs=700x280&chd=s:el,or&chco=4d89f9,c6d9fd);}
#chart2{background-image:url(http://chart.apis.google.com/chart?cht=p&chd=s:Uf9a&chs=700x280&chdl=May|Juny|July|August);}
#chart2:hover{background-image:url(http://chart.apis.google.com/chart?cht=bhg&chs=700x280&chd=s:el,or&chco=4d89f9,c6d9fd&chbh=15,4,15);}
#chart3{background-image:url(http://chart.apis.google.com/chart?cht=p&chd=s:Uf9a&chs=700x280&chl=September|October|November|December);}
#chart3:hover{background-image:url(http://chart.apis.google.com/chart?cht=bvg&chs=700x280&chd=s:hello,world&chco=4d89f9,c6d9fd&chbh=15,4,15);}
/*]]>*/
</style>
<a id="chart1" class="chart" href="javascript://"><br/></a>
<a id="chart2" class="chart" href="javascript://"><br/></a>
<a id="chart3" class="chart" href="javascript://"><br/></a>

Categories

Resources