PDA

View Full Version : Targeting the Floating Frame



nancy
04-22-2005, 07:34 PM
Hi,
I want to say how easy it was to implement your floating frame script... very straight-forward.

I'm having trouble, however, to target that IFrame ("masterdiv") with a <AHREF..>

Briefly, I have a list of people that when clicked on, their picture *should* load into this IFRAME, and replace the "temporary.htm" page I've put into it as a placeholder.

The picture loads .. but it replaces the page completely ..not IN the IFRAME ???

Here's the chunk of HTML code:

************************************************

<a href="<%=PICurl%>" OnClick="javascript:changePic()" class="docs"><img src="../img/EMPpic.jpg" border="0"></a>


**************************************************

and Here's the chunk of Javascript code:

**************************************************

<script>
function changepic(){
parent.document.getElementById("masterdiv")
}
</script>

**************************************************

I think it has to do with my DOM stucture...

Please advsie,
Thanks
nancy

ddadmin
04-26-2005, 08:54 PM
., in this case, http://www.dynamicdrive.com/dynamicindex17/floatiframe.htm

Try the below function:


<script type="text/javascript">
function changepic(picsrc){
parent.document.getElementById("masterdiv").Document.body.innerHTML='<img src="'+picsrc+'">'
}
</script>

<a href="javascript:changepic('dog.gif')">Change picture</a>

nancy
04-26-2005, 09:04 PM
Related Topic:
http://www.dynamicdrive.com/dynamic...floatiframe.htm


I've solved the problem, quite simply frankly...
Here's the code that fixed the problem:

<a href="<%=PICurl%>" target="masterdiv" .... >

I targeting the name of my floating frame and Voila!

Thanks all for your help,
nancy

ddadmin
04-26-2005, 09:16 PM
LOL why didn't I think of the "target" attribute?