You are here: Re: getting image to work... « HTML « IT news, forums, messages
Re: getting image to work...

Posted by Mitja Trampus on 10/09/05 23:39

SpaceGirl wrote:
> joshkotecha@gmail.com wrote:
>> The problem is that the picture doesn't fit the middle column. I get
>> scroll bars -- this is what I don't want. If I made the center a <img
>> src="mypic1.jpg" id="pic" name="pic"></img> the picture shows up. But I
>> can't get the src name in javascript. I keep getting NaN or undefined.
>> I'm doing mypix = document.getElementByID("pic").src. This works with iframe,
>> but doesn't work with image.

You sure? No typos (e.g. ById, not ByID)? The following
(ugly and test-only) code works for me:

<body>
<img src="foo" id="pic">
<a onclick=""
href="javascript:alert(document.getElementById('pic').src)">foo</a>
</body>



> Btw...
>
> <img ... />
>
> or
>
> <img ... >
>
> You dont close <img> tags unless you are doing XHTML.

While we're there...
<foo bar="qux"/> is just shorthand for <foo bar="qux"></foo> :)

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация