Click to See Complete Forum and Search --> : writing an image..


bjoerndalen
01-10-2003, 02:44 PM
I've got a drop down menu that features a selection of images.What I want to happen is the user to pick an image and then the selected image to be written to another frame. Is this possible?? I understand you can add nodes in the DOM. Is it possible to use the createElement()??If so how??Any help would be much appreciated. :confused:

swon
01-10-2003, 03:25 PM
Hi bjoern,

if you have an frameset like:

<frameset rows="80,100,*">
<frame name="top" scrolling="NO" noresize src="create.html">
<frame src="bottom.html" name="bottom" noresize>
</frameset>
--------------------------------------------------------------
top frame includes:

<script language="JavaScript">
<!--
function createImgs(imgs){

var t = parent.bottom;
var elm = t.document.getElementById("MyCreate")
var newimg = t.document.createElement("img");

newimg.setAttribute("alt",imgs);
newimg.setAttribute("src",imgs);
elm.insertAdjacentElement("BeforeEnd",newimg);
}
//-->
</script>

<body>
<a href="myImage.jpg" onClick="createImgs(this.href);return false">Create myImage.jpg</a>
<a href="your-Image.jpg" onClick="createImgs(this.href);return false">Create your-Image.jpg</a>
</body>

----------------------------------------------------------------------
bottom frame includes:

<div id=MyCreate></div>

----------------------------------------------------------------------

bjoerndalen
01-10-2003, 04:41 PM
Thanks Swon for the advice. I'll give it a go over the next few days and let you know how I get on.

:)

bjoerndalen
01-15-2003, 08:09 AM
I don't know if you'll read this Swon but just thought i'd let you know that thanks to you I've managed to write the image to the correct frame ...Thanks...On to the next problem now!!!:confused:

swon
01-15-2003, 08:18 AM
;) You're welcome!

bjoerndalen
01-15-2003, 08:23 AM
Glad you got the thanks message ...much appreciated... If you would like my thanks again then i've just posted another thread...

If you get chance maybe you could have a look for me...

Thanks again

Dave:D