
Originally Posted by
khaled450
is there a better way around this?
Well, the main thing is that you need to take into account the facts I mentioned. And, yes there is a better way, any way that worked would be better. There are, in fact 'many ways to skin a cat.' Here's one:
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Example</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script type="text/javascript">
function size(el){
var s = el.style, w = 'width', h = 'height';
if(s[w] != '150px'){
s[w] = '150px';
s[h] = '200px';
}
else {
s[w] = '300px';
s[h] = '500px';
}
};
</script>
</head>
<body>
<div>
<img style="width:300px; height:500px; cursor:pointer;"
onclick="size(this)" src="zoro15.jpg" alt="">
</div>
</body>
</html>
Bookmarks