Wrox Home  
Search P2P Archive for: Go

  Return to Index  

javascript_howto thread: Dynamically adjusting WIDTH and HEIGHT for IMG and OBJECT tags?


Message #1 by "Warrick Wilson" <wwilson@f...> on Tue, 21 Aug 2001 15:06:36 -0400
Hi Warrick,

Try this code - this code lets you see and change properties on an object -
in this case an image. You should save it and in the same directory as the 
HTM file put any picture with a name: "image.jpg" :-)

The code takes each properties of an object and displayes them. It is
extended with the onchange listner on each input field which will set the 
property dynamically as you change them!

Kind'of fun! :-)

Cheers

Sten Hougaard
EDB Gruppen


<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
<TITLE></TITLE>
<style type="text/css">
.tryme { width: 100px; height: 100px}
</style>

<SCRIPT LANGUAGE=javascript>
<!--

function showprop() {
     var proplist = '<table border=0>';
     for(i in billede) {
          vOnChange = 'billede.'+i+"=this.value";
          proplist+="<td>"+i+"</td><td>"
          if (typeof eval('billede.'+i) != 'object') {
               proplist+="<input type=\"text\" value=\""+eval('billede.'+i)
+"\" onchange=\"eval(\'"+vOnChange+"\')\"></td></tr>"
          } else {
               proplist+="[object]</td></tr>"
          }
     }
     proplist+="</table>"
     output.innerHTML = proplist;
}

//-->
</SCRIPT>
</HEAD>
<BODY onload="showprop()">
<div style="border: 1px dotted blue">
<img src="image.jpg" id="billede" name="billede" align="left" hspace
="4">This is the picture.<br>Below will show a list of properties<br>which
you can change <b>dynamically</b>..<br>
</div>
<br clear="all">
<div id="output">
placeholder for output
</div>
</BODY>
</HTML>




                                                                                                                     
                                          

------- old message --------


I have a frameset that loads various HTML files. I've done the rows and
cols by percentages here.

I'd like to set up the individual HTML pages to accommodate different
browser sizes, which will lead to different frame sizes. In these files, I
will have images and OBJECT tags, each of which have WIDTH and HEIGHT
values.

Is there some way to figure out what the available space is as I load an
HTML file into a frame? I was trying to document.write() stuff, but I can't
figure out what the available space is. I can do screen.width and
screen.height, but those are not the values I need.

I'm using IE 5.0 and IE 5.5, and will ONLY be using those.

Thanks.



Warrick Wilson
Fred Systems Ltd.


  Return to Index