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

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
C3-->D3 Line Chart 4 33
Fixing my modal from bootstrap 18 39
How can I   ajax html table  rows? 20 60
Need to click button twice to get results 2 32
Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
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 learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

948 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now