PDA

View Full Version : quick help with simple code



Gyms
Oct 24th, 2010, 04:10 AM
Hi... i have this code:
<script type='text/javascript'>

cookie_name = GetCookie("href_location");

if(cookie_name){
alert("Cookie found, redirecting to stored cookie.");
document.location.href=cookie_name;
}

</script>
I will like to create a iframe using the info from the "cookie_name" value

<iframe name="FRAME1" src="cookie_name" width="350" height="320" frameborder="0" scrolling="auto"></iframe>

I have a script that set a cookie with the value of a chosed website, what i need now is to create an iframe with that value.

Any help will be apriciated.
Sorry for my poor enlish

Logic Ali
Oct 24th, 2010, 08:51 AM
Perhaps something like this:
<div id='iframeHolder' ></div>

<script type='text/javascript'>

var ifr,
ifParent = document.getElementById( 'iframeHolder' ),
locn;

if( ( locn = GetCookie( "href_location" ) ) )
{
ifr = document.createElement( 'iframe' );
ifr.src = locn;
ifr.width = 350;
ifr.height = 320;
ifParent.appendChild( ifr );
}

</script>