Link to home
Start Free TrialLog in
Avatar of CalmSoul
CalmSoulFlag 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,
Avatar of Kiran Paul VJ
Kiran Paul VJ
Flag of India image

you can do this by using a iframe inside the div

eg:

<div id="iframe_div">
<iframe src="" width="500" height="500"></iframe>
</div>
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>
Avatar of 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?
put that in your master file, the file which shows all contents
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
Avatar of Kiran Paul VJ
Kiran Paul VJ
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial