Closed Thread Icon

Preserved Topic: Resizing Div's with JS... (Page 1 of 1) Pages that link to <a href="https://ozoneasylum.com/backlink?for=18458" title="Pages that link to Preserved Topic: Resizing Div&amp;#039;s with JS... (Page 1 of 1)" rel="nofollow" >Preserved Topic: Resizing Div&#039;s with JS... <span class="small">(Page 1 of 1)</span>\

 
YoYoFREAK
Paranoid (IV) Mad Scientist

From: A lost remnant
Insane since: Jun 2001

posted posted 10-25-2001 02:54

I need some help, basically what I am trying to accomplish is to resize the height of a div with the onlick of a .gif image. So I have a div on a page that is absolute positioned when the user clicks on an image the div resizes to 100% of the height of the page from the amount of pixels I specify it from the top. Does anybody have a script that would work like this? If anyone could help me I would much appreciate it.
Thanks
-YoYoFREAK

Pugzly
Paranoid (IV) Inmate

From: 127.0.0.1
Insane since: Apr 2000

posted posted 10-25-2001 05:10

See if this will help - http://www.runningwolf.com/development/code/resize_image.htm

You might be able to apply the same logic.

YoYoFREAK
Paranoid (IV) Mad Scientist

From: A lost remnant
Insane since: Jun 2001

posted posted 10-25-2001 07:56

Pugzly,
Sorry I couldn't get that script to work. Anything else you could think of that might help me to get it to work?

This is the code I am using:

<style type=text/css>
body, td, tr {font-family: verdana; font-size: 10px}
</style>
<script language=javascript type=text/javascript>
function resize(div){
if (document.getElementById(div).width == 640){
document.getElementById(div).setAttribute("width", 320);
document.getElementById(div).setAttribute("height", 240);
}
else{
document.getElementById(div).setAttribute("width", 640);
document.getElementById(div).setAttribute("height", 480);
}
}
</script>
</head>
<body bgcolor="#FFFFFF" text="#000000">
<a href=javascript:resize("div");>Resize Div</a>
<div id="div" style="position: absolute;
left: 100; top: 100; width: 640; height: 480;
background-color: #666666">
</div>


If you could tell me how to make any improvements to make it work I would appreciate it.
Thanks
-YoYoFREAK

DmS
Paranoid (IV) Inmate

From: Sthlm, Sweden
Insane since: Oct 2000

posted posted 10-25-2001 10:35

This will work in IE. It will also do the same on the width-part, it's commented on what to remove if you don't want that.
There is a bug in this script, it doesn't know how to reach/change the height & width of a div in Netscape (and neither do I) I'm sure someone here can fix that.

<BLOCKQUOTE><FONT face="Verdana, Arial">code:</font><HR><pre>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<html>
<head>
<title>ExpandoLayero</title>
<script language="JavaScript">
/* written 2001-10 by DmS@ www.dmsproject.com - Use it freely. */
function reLoad(){
if(document.layers){
location.reload();
}
}
function getObj(name) {
if (document.getElementById)
return document.getElementById(name).style;
else if (document.all)
return document.all[name].style;
else if (document.layers)
return document.layers[name];
}

function expandLayer(layerName){
var x = getObj(layerName);
if(document.all

lallous
Paranoid (IV) Inmate

From: Lebanon
Insane since: May 2001

posted posted 10-25-2001 15:38

<BLOCKQUOTE><FONT face="Verdana, Arial">code:</font><HR><pre>
if(document.all <B>

YoYoFREAK
Paranoid (IV) Mad Scientist

From: A lost remnant
Insane since: Jun 2001

posted posted 10-25-2001 18:49

DMS,
I couldn't get that script to work either - I get an error line 1 char 1 object expected in IE 5.5.
Any tips on how to get it to work?
Thanks
-YoYoFREAK

DmS
Paranoid (IV) Inmate

From: Sthlm, Sweden
Insane since: Oct 2000

posted posted 10-25-2001 22:02

YoYo and Iallous.
The script works fine, IF you do exactly what Iallous pointed out...
this line:
<B>if(document.all

mr.maX
Maniac (V) Mad Scientist

From: Belgrade, Serbia
Insane since: Sep 2000

posted posted 10-25-2001 22:29

&#124;&#124;&nbsp;&nbsp;&nbsp;&#124;&#124;&nbsp;&nbsp;&nbsp;&#124;&#124;&nbsp;&nbsp;&nbsp;&#124;&#124;&nbsp;&nbsp;&nbsp;&#124;&#124;

There, it can be written properly...


DmS
Paranoid (IV) Inmate

From: Sthlm, Sweden
Insane since: Oct 2000

posted posted 10-25-2001 22:51

!!! wtf, how???
let us in on the secret...
Dan


-{ a vibration is a movement that doesn't know which way to go }-

Pugzly
Paranoid (IV) Inmate

From: 127.0.0.1
Insane since: Apr 2000

posted posted 10-26-2001 16:26

&#124;&#124;&nbsp;&nbsp;&nbsp;&#124;&#124;&nbsp;&nbsp;&nbsp;&#124;&#124;&nbsp;&nbsp;&nbsp;&#124;&#124;&nbsp;&nbsp;&nbsp;&#124;&#124;

Heheheh -- good one, Max!



[This message has been edited by Pugzly (edited 10-26-2001).]

mr.maX
Maniac (V) Mad Scientist

From: Belgrade, Serbia
Insane since: Sep 2000

posted posted 10-26-2001 22:29

Dan, I'll tell you the secret when you start crediting me in your code that uses parts of my code...


DmS
Paranoid (IV) Inmate

From: Sthlm, Sweden
Insane since: Oct 2000

posted posted 10-27-2001 22:09

mr.Max
First of all, this doesn't feel cool at all smiley or no smiley...
Are you referring to this part?

function getObj(name) {
if (document.getElementById)
return document.getElementById(name).style;
else if (document.all)
return document.all[name].style;
else if (document.layers)
return document.layers[name];
}

I know you have it in different forms in a lot of different scripts and I have no idea how long you have been using getObject(), but I know when I picked it up and it wasn't from you.

It was in late may 2000 when we started a project ( http://www.production.globeacademy.com/ (top menu)) at netmolecule where I was working at the time, If my memory serves me right, I hadn't even found this place yet.

I do know that I posted it myself here for the first time as an answer in a js-thread about hiding/showing div's, where you later in the thread showed us how to modify it to handle several div's. In that thread we were both commented on by doc on the quality of the code snippets.
Mayby you had used it earlier than that thread, I don't know.

I don't feel any ownership to this piece of code, not in any way, it's simply a very useful piece of code!
However, I'm very sure that I havn't ripped it from you mrMax! Sure I removed the }{ from it somewhere in time, maby I got that from you, don't really remember.


Then I used getObject() in a later thread as part of a crappy script to move a layer, you amongst several others, bitdamaged, slime, helped me fix it. You even rewrote the whole script in a much more compact from, this compact version I then used together with some of mine and forgot to credit you, I was notified on my fuckup, corrected it and told you I was sorry. This would have been somewhere around october 2000.

You are a superb resource here mr.Max, there is no doubt about that, not from me or anyone else!
Me and a lot of other people here have learned a lot from you and your willingness to help, and there is no doubt that you deserve a lot of credit, from me as well as others.

But if you feel that I am using your code and claiming it as mine, do come out and say it! More so, please point me to where I am doing it, because I do not believe I am using anything of yours without due credit, hence I see no reason for this!

Please explain yourself because this is starting to feel really stupid!
/Dan


-{ a vibration is a movement that doesn't know which way to go }-

« BackwardsOnwards »

Show Forum Drop Down Menu