Jump to content

onclick to iframe


keefus

Recommended Posts

Hi i'm pretty new to php so bare with me.

 

I am installing a "recommend to a friend script" for my site and have the javascript for the link. which opens up the script with the form to send the email of the page. It all works fine but i'd like the form to open up inside an iframe on my page so i don't have to create a new CSS file. The code for the link is:

<script language="Javascript1.2">
document.write('<a href="javascript:void(0)" onclick=window.open("recommend.php?loc='+window.location.href+'","","height=280,width=260,top=150,left=200,toolbar=no,menubar=no,location=no,status=no,resizable=1"); title="Recommend this to a friend">SEND TO A FRIEND</a>');
</script>

 

Any help you can give me on this will be greatly appreciated and would save me loads and loads of time.

 

thanks in advance.

 

PS. i tried searching the forums for another post but the search function isn't working.

Link to comment
https://forums.phpfreaks.com/topic/130573-onclick-to-iframe/
Share on other sites

You need to create an iframe (if you want to do it that way), and give it a unique id, like recommend_frame.

Then your JavaScript can be:

 

<script language="Javascript1.2">
document.write('<a href="javascript:void(0)" onclick=document.getElementById("recommend_frame").src="recommend.php?loc='+window.location.href+'" title="Recommend this to a friend">SEND TO A FRIEND</a>');
</script>

Link to comment
https://forums.phpfreaks.com/topic/130573-onclick-to-iframe/#findComment-677976
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.