Thread: JavaScript Help
View Single Post
 
JavaScript Help
Reply
Posted 2008-11-18, 03:22 PM
Well, at one point in the process of me testing this, it worked. However, as of right now, absolutely nothing happens. Check it out.

Code:
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Picture Zoom In/Out</title>
<script type="text/javascript" language="javascript">
function zoom(file) {
	var image_main = new Object(), hei = new Object(), wid = new Object(); // I just cleaned this up for this edit.
	image_main = document.getElementById('zoom_' + file);
	hei = parseInt(image_main.style.height);
	wid = parseInt(image_main.style.width);
	image_main.style.height = (hei + 7) + 'px';
	image_main.style.width = (wid + 7) + 'px';
}
function zoomout(file) {
	var image_main = new Object(), hei = new Object(), wid = new Object(); // Same thing, I edited this to make it easier.
	image_main = document.getElementById('zoom_' + file);
	hei = parseInt(image_main.style.height);
	wid = parseInt(image_main.style.width);
	image_main.style.height = (hei - 7) + 'px';
	image_main.style.width = (wid - 7) + 'px';
}
</script>
</head>
<body>
<img style="height:7px;width:7px;" src="background-lo3.GIF" id="zoom_now" name="zoom_now" /><br />
<input type="button" value="Zoom In" onclick="javascript:zoom('now');" /><input type="button" value="Zoom Out" onclick="javascript:zoomout('now');" />
</body>

Edit 2: Oh bloody hell. It works again! Apparently there was something I did before not causing it to work. It works now. ~sorry. I'd been working a fix for an hour though. So I wasn't just writing this thread out for no reason.

Edit 3:
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<script type="text/javascript" language="javascript">
var did = 0; // Does a check against if that was used last.
function random_msg(num) {
	var msg = new Array();
	msg[0] = "This will Never Be True"; // Really
	msg[1] = "No, don't leave";
	msg[2] = "Leaving is against the rules";
	msg[3] = "Aw, leaving!";
	msg[4] = "No way.  You're leaving!?";
	for (i=0; i < num; i++) {
		var mm = new Object();
		var rand = 5;
		while (rand > 4) {
			rand = Math.ceil(100*Math.random());
		}
		mm = msg[rand];
		if (did!=mm) {
			alert(mm);
			did = msg[rand];
		}
		else {
			i -= 1;
		}
	}
}
</script>
</head>
<body onunload="javascript:random_msg(1000);">
</body>
</html>

I just created this script. I believe it works as is perfectly.
 
Work List
疲れていますから 寝むってありますね。 むずかしいです。 また、ケーキ屋で ケーキを食べていました。

I've considered being a translator, but I dunno. It feels like a lot of work. If someone gets angry then I have to deal with it, you know? I'd rather just relax.

 
Speed Test
 
Favorite Anime/Manga
#01 Clannad ~After Story~
#02 Trigun {Maximum}
#03 Koi Kaze
#04 Berserk
#05 Outlaw Star
#06 Slayers
#07 Desert Punk
#08 Spirited Away
#09 Fullmetal Alchemist
#10 Shakugan no Shana
#11 Death Note
#12 FLCL
#13 Tokyo Magnitude 8.0
#14 Toradora
#15 Gunslinger Girl

 
Anime List

Last edited by Goodlookinguy; 2008-11-18 at 09:18 PM.
Old
Profile PM WWW Search
Goodlookinguy seldom sees opportunities until they cease to beGoodlookinguy seldom sees opportunities until they cease to beGoodlookinguy seldom sees opportunities until they cease to beGoodlookinguy seldom sees opportunities until they cease to be
 
 
Goodlookinguy