if I have a page called “content page”:
<body >
<p id="part1">Tread ... inch. </p>
<p id="part2">Tread ... inch. </p>
<p id="part3">Tread ... inch.</p>
</body>
and another page with this java script(code in close icon doesn't appear ).
<head>
<script type="text/javascript" src="popupBox.js"></script>
</head>
<body>
show content of part one : <a href="TreadDepth.html" onClick="return show_hide_box(this,400,400,'2px solid')">Click Here</a>.
show content of part two : <a href="TreadDepth.html" onClick="return show_hide_box(this,400,400,'2px solid')">Click Here</a>.
show content of part three : <a href="TreadDepth.html" onClick="return show_hide_box(this,400,400,'2px solid')">Click Here</a>.
</body>
if I want to retrive a specific part of a content page to be shown in the popup box, is that possible?
I mean in this part at popup.js:
var boxdiv = document.getElementById(href);
can I specify an ID of a tag in the href of the page to retrive it? like :
var href = an.href;
var boxdiv = document.getElementById(href).getElementById("Show The content of this ID tag!");
any idea?
What you’re asking for reminds me of how WML works, with multiple cards on a single page, only one of which is shown at once. It’s possible to load the content of one page in another, but not the way you envision.
As you might guess from the name,
getElementByIdgets an element based on the ID attribute, nothing else. Instead, you have to load the content of the other page, at which point you can show parts of it on demand.In popupBox.js:
In the other page:
It’s generally considered better form to subscribe event listeners in a script, rather than inline in HTML. Also, don’t use “click here” for link text.