Zelaron Gaming Forum

Zelaron Gaming Forum (http://zelaron.com/forum/index.php)
-   Tech Help (http://zelaron.com/forum/forumdisplay.php?f=329)
-   -   JavaScript Help (http://zelaron.com/forum/showthread.php?t=47558)

Goodlookinguy 2008-11-18 03:22 PM

JavaScript Help
 
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.


All times are GMT -6. The time now is 03:53 PM.

Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
This site is best seen with your eyes open.