Jump to content

control the location of a iframe via a div

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
1 reply to this topic

#1
welton122

welton122

    Learning Programmer

  • Members
  • PipPipPip
  • 76 posts
hi all,

ok i have hardly any JavaScript experience but a new feature i am implementing into a site uses iframes (i am implementing graphs that use Google analytics). I have it all working perfectly apart from one problem, the location on the web page. I was wondering how do i move a iframe around the page or if its going to be to difficult, is it possible to put it inside a div tag. I have tried with a div already but it doesn't seem to make a difference.

Many Thanks,
J

#2
nikodz

nikodz

    Newbie

  • Members
  • PipPip
  • 12 posts
<html>

<head>

</head>

<script type="text/javascript">

function changesrc(){

	document.getElementById("IFrame1").src="http://forum.codecall.net";

}

</script>

<body>

<input type=button value="Change" onclick="changesrc()"><br><br>

<iframe width="50%" height="50%" id="IFrame1" src="http://google.com"></iframe>

</body>

</html>