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]
|