irt.org Home Articles FAQs XREF Games Software Instant Books BBS About FOLDOC RFCs Feedback Sitemap
irt

Q1510 How can I make the width of an image the same as the width of the visitor's window?

You are here: irt.org | FAQ | JavaScript | Image | Q1510 [ previous next ]

Try:

<script language="JavaScript"><!--
if (document.all) w = document.body.clientWidth;
else if (document.layers) w = window.innerWidth;
else w = 640;
document.write('<img src="stretch.gif" width="' + w + '" height=200">');
//--></script>

©2013 Martin Webb

ArticlesFAQsGamesFeedback

FOLDOCRFCsInstant JavaScriptSoftwareBooksJavaScript Programmer's ReferenceAboutTop