Okay tested it, got some things not working:
1)mouse hover doesn't work any more
2)the images "move" a bit when clicking them
3)the other script stopped working, the image url isn't shown anymore...
The script you gave does work, but cancels a lot of other things.
My code now:
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
.border img{
border: 2px solid white;
}
.border:hover img{
border: 2px solid lightgrey;
}
.border:active img{
border: 2px solid red;
}
</style>
<script type="text/javascript">
Array.prototype.indexOf = function(o) {
for(var i=0;i<this.length;i++) if(this[i] == o) return i;
return -1;
}
document.borderedImages = new Array();
function borderImage(img) {
if(document.borderedImages.indexOf(img) == -1) document.borderedImages.push(img);
for(var i=0;i<document.borderedImages.length;i++) document.borderedImages[i].style.borderStyle = "none";
img.style.border = "solid 2px red";
}
</script
<script language="JavaScript">
var isReady = false;
function showAddress(What){
if (isReady){
document.Which.Where.value = What;
}else{
alert("Not so fast...\nPlease wait for the page to finish loading.");
}
}
function clearAddress(){
if (isReady){
document.Which.Where.value = '';
}else{
alert("Not so fast...\nPlease wait for the page to finish loading.");
}
}
</script>
</head>
<body onload="isReady=true">
<a class="border"><img src="dir/a.png"
width="60"
height="60"
border="0"
onclick="borderImage(this);"
onMouseDown="showAddress(this.src)"></a>
<a class="border"><img src="dir/b.png"
width="60"
height="60"
border="0"
onclick="borderImage(this);"
onMouseDown="showAddress(this.src)"></a>
<form name="Which">
<input type="text" size="360" name="Where">
</form>
</body>
</html>
Greetz
edit: ow and this code is displayed:
Code:
var isReady = false; function showAddress(What){ if (isReady){ document.Which.Where.value = What; }else{ alert("Not so fast...\nPlease wait for the page to finish loading."); } } function clearAddress(){ if (isReady){ document.Which.Where.value = ''; }else{ alert("Not so fast...\nPlease wait for the page to finish loading."); } }
Bookmarks