image from variable

Posted on 1999-01-29
Last Modified: 2010-04-09
say I have an object that has a property picturepath
so I like to use this property to get my picture.
I tried like this
<OBJECT ID="mypictureobject" CLASSID="CLSID:9AA7F4F0-629F-11D2-8CEB-00A0C949D865"></OBJECT>
<IMG SRC= 'mypictureobject.picturepath'>

but !!!! this does not work, all
mypictureobject.picturepath is a path to xxx.gif, and
I verified it is correct.
please if you are not sure about your answer
put is as comment.
Question by:hasmet
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

Expert Comment

ID: 1845836
That will just set SRC to "mypictureobject.picturepath".
If you want to set it to the actual value of the variable, use this simple JavaScript:

document.write('<IMG SRC="' + mypictureobject.picturepath + '">');
// -->

LVL 13

Accepted Solution

Epsylon earned 100 total points
ID: 1845837
You have to do somthing like this:

<BODY onLoad="MyImage.src=mypictureobject.picturepath")>
<OBJECT ID="mypictureobject" CLASSID="CLSID:9AA7F4F0-629F-11D2-8CEB-00A0C949D865"></OBJECT>
<IMG SRC="dummy.gif" NAME="MyImage">


Author Comment

ID: 1845838
<OBJECT ID="mypictureobject" CLASSID="CLSID:9AA7F4F0-629F-11D2-8CEB-00A0C949D865"></OBJECT>
<IMG ID = myimage>
myimage.src = mypictureobject.picturepath;

above works fine

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Ouput in html in powershell 2 32
Send email using HTML and PHP in separate file 5 41
How to calculate height of a text using jquery 3 42
Link not working 6 43
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
When crafting your “Why Us” page, there are a plethora of pitfalls to avoid. Follow these five tips, and you’ll be well on your way to creating an effective page.
In this tutorial viewers will learn how add a scalable full-width header using CSS3. Create a new HTML document with an internal stylesheet. Set a tiled background.:  Create a new div and name it Header. Position it with position:absolute at the top…
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question