Вопрос

I want such that if anyone click a link then on that page only (in which the person clicked link)another page should open as an embeded page or a i frame. how can I do this on my website using html or javascript ?

Это было полезно?

Решение

try this but im not sure it works. JSFiddle - link

EDIT: Html

<body>
  <div id="box">
     <a href="javascript:show();" >Link</a>
  </div>
  <div id="box2">    
     <iframe src="" id="frame" width=100% height=100%></iframe>
     <div id="close"><input type="button" onclick="closeIframe()" value="X" /></div>
  </div>
</body>

Javascript

function show()
{
  box= document.getElementById("box");
  box.style.visibility="hidden";

  frame=document.getElementById("box2");
  frame.style.visibility="visible"; 
}
function closeIframe()
{
  box2=document.getElementById("box2");
  box2.style.visibility="hidden";
  box= document.getElementById("box");
  box.style.visibility="visible";
}

CSS

#box
{  
   background-color:yellow;
}
#box2
{
   position:absolute;
   top:7px; //here i've set 7px but you cant set what you want 
   visibility:hidden;
}
#close
{
   position:relative;
   left:100%;
   width:50px;
   top:-160px;
 }
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top