Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
22
rated 0 times [  26] [ 4]  / answers: 1 / hits: 15874  / 13 Years ago, mon, april 18, 2011, 12:00:00

I am attempting to have a link load an article from my domain in to an iframe. I understand that it is usually easy to link using:



<a href=# onClick=window.open('http://www.google.com');return false>Google</a>



But when it comes to Iframes I am having difficulty formatting the code correctly so that it will display inside the iframe.



I can not use:



<a href=http://www.google.com target=your_frame_name>Google</a>



Because I need to use an onClick so I can execute more than one command.



I have tried iterations of:



<A HREF=# onclick=window.framename.location='page.htm';>text</A>



<A HREF=# onClick=window.open('your url', 'frameName'); return false>text</a>



<A HREF=# onclick=document.framename.location.href='page.htm'; return false>text</a>



and none of them are doing anything.



Thank you in advance,



Spence


More From » iframe

 Answers
85

use link and do what ever you want to do in onclick event



<a href=http://www.google.com target=your_frame_name onclick=executeOnClick()>Google</a>

<script type=text/javascript>
function executeOnClick(){

// add your logic here


return true;
}
</script>

[#92666] Saturday, April 16, 2011, 13 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
brynneg

Total Points: 205
Total Questions: 111
Total Answers: 112

Location: Djibouti
Member since Wed, Dec 8, 2021
3 Years ago
;