I have a main Page with an advert (A). Clicking advert (A) should open the page (B) with an "iframe" in it and the I frame should show an html article page (C). This iframe in page (B) is used to open a lot of articles, but I don't know how to target a specific one using HREF or ONCLICK? please help.
Asked
Active
Viewed 281 times
1 Answers
0
A.html:
<a target="_blank" href="B.html?go=C.html">my ad</a>
B.html:
<script>
function getParameterByName(name) {
name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"),
results = regex.exec(location.search);
return results === null ? "" : decodeURIComponent(results[1].replace(/\+/g, " "));
}
document.write('<iframe src="' + getParameterByName("go") + '"></iframe>');
</script>
C.html:
lorem ipsum dolar sit amet

daghan
- 948
- 10
- 18