Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

setting parameters in 'resource window'

Status
Not open for further replies.

Seabone

Technical User
Jan 12, 2001
15
CA
Hey there,
I'm working in HTML and want to change the look of the resource window. I know you can do it in javascript (with a button but I want to resize an image and not have a button pop up) but does anybody know how to do it in simple HTML (since nobody's in the HTML forum)?
or simple javascript will do and where in the document do you place the javascript code?
Thanks a bunch
 
What exactly do you mean by resource window? You know what does "resize an image and not have a button pop up" mean?

Put a little code in, so we can see what you're wanting to do. :)
b2 - benbiddington@surf4nix.com
 
Ah, that's the problem...lack of clarity.
I have a small picture that I want people to be able to click on it and a larger version comes up.
in HTML I have
<img src=&quot;sdssd.gif&quot; target=&quot;resource window&quot;>

the image becomes clickable and a large window pops up containing the bigger image but the window doesn't exactly fit the image. The window also contains the address bar and standard buttons which I don't want. I'd like to fit the larger image exactly in the window with nothing else and perhaps set the bg color.

I know there's javascript code but I'm not sure were I should put it in a simple HTML document.
I hope this helps
Thanks
 
Sounds to me like you are looking for a javascript function to open a popup window with the image in it, so here goes:
Code:
<script language=javascript>
function openIt(imgSrc){
  window.open(imgSrc, 'pictureWindow', 'height=200,width=200,toolbar=no,locationbar=no');
}
</script>

then you call it like this:
Code:
<a href=&quot;javascript:openIt('sdssd.gif')&quot;>
<img src=&quot;sdssd.gif&quot;>
</a>

I'm not sure about setting the background color -- maybe someone else can help us out on that one, but there are a bunch of other properties you can set on that window, and you can find the full list at:

hope it helps! :)
Paul Prewett
 
Link9 got it, I think. To set the bgcolor, you would want to load a new HTML doc in the new window rather than just an image.

The new HTML document would in turn contain an IMG tag for the appropriate image. Then you could set the bgcolor in the BODY tag. You could also control the title by setting it with the TITLE tag.

In the BODY tag use marginheight=&quot;0&quot; and marginwidth=&quot;0&quot; (for Nutscape) and topmargin=&quot;0&quot; and leftmargin=&quot;0&quot; (for Internet Exploder) to make the margin around the image disappear. (Use all four attributes to make page browser-compatible)
 
Personally I don't like windows mainly because you can't get rid of all the title crap - what about writing the bigger image to a span? Store all the image names in an array - so you can access them easily (Note: we are NOT pre-loading). Yo just need something like:
<script>

var imgs = new Array();
imgs[0] = &quot;images/pic_1.jpg&quot;;

function blowUp(spanName,index){
var bigPic = document.getElementById(spanName);
bigPic.style.visibility = &quot;visible&quot;;
bigPic.innerHTML = &quot;<img src='&quot; + imgs[index] +&quot;' border='0'>&quot;;
}

</script>


So this function can cope with many different image containers - you just give it the name of the span/div to use - (you may be able to use an img tag, thought I wonder about dynamically changing the size.) and the index of the image, and it is written into it. This way you can customize your 'frame' - and it is still loaded dynamically.

You just need to write code which hides it again when you want.

b2 - benbiddington@surf4nix.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top