Avatar of CalmSoul
CalmSoul
Flag for United States of America asked on

How to display clicked URL in div tag ?

I have a simple php template code ... which I got from following website

http://www.codewalkers.com/c/a/Display-Tutorials/Writing-a-Template-System-in-PHP/

in submenu I want to put the links but they are opening in the new windows or on the same window

i want them to open in {menu} div tag ....

regards,
PHP

Avatar of undefined
Last Comment
Kiran Paul VJ

8/22/2022 - Mon
Kiran Paul VJ

you can do this by using a iframe inside the div

eg:

<div id="iframe_div">
<iframe src="" width="500" height="500"></iframe>
</div>
Kiran Paul VJ

and alter these lines (i guess)

&lt;a href="link1.php" id="menuItem1"&gt;link 1&lt;/a&gt;
&lt;a href="link2.php" id="menuItem2"&gt;link 2&lt;/a&gt;
&lt;a href="link3.php" id="menuItem3"&gt;link 3&lt;/a&gt;
&lt;a href="link4.php" id="menuItem4"&gt;link 4&lt;/a&gt;

to something like

&lt;a href="link1.php" onclick="javascript:document.getElementById('my_iframe').src='link1.php'" id="menuItem1"&gt;link 1&lt;/a&gt;

and give the id of iframe as my_iframe

<div id="iframe_div">
<iframe id="my_iframe" src="" width="500" height="500"></iframe>
</div>
CalmSoul

ASKER
where should i put this

<div id="iframe_div">
<iframe id="my_iframe" src="" width="500" height="500"></iframe>
</div>

in which file?
All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck
Kiran Paul VJ

put that in your master file, the file which shows all contents
CalmSoul

ASKER
when I click on the link it is still not showing page in the iframe code attached
main.html
 
<div id="iframe_div">
<iframe id="my_iframe" src="" width="500" height="500"></iframe>
</div>
 
submenu.html
 
     <li>
	 <a href="addCricketMatch.php" onclick="javascript:document.getElementById('my_iframe').src='addCricketMatch.php'" id="menuItem1">Add Cricket Match(s)</a>

Open in new window

ASKER CERTIFIED SOLUTION
Kiran Paul VJ

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.