The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
Help on javascript
I have links on my index page. When a person clicks the links I need the src of an iframe on another page to reflect what link was clicked.
It works ok if the link was opening up a standard html page but now I want that iframe page to be wrapped in vbulletin. Home page with the links is index.php The html page with the iframe is test.html The iframe is named view When wrapped in vbulletin it is a page called testpage The script I have on my test.html page is: Code:
<script type="text/javascript"> function iframe_src() { var locsubstr = location.search.substring(1);//find url parameter if((locsubstr.indexOf("view")!= -1))//if there is a new path for changeme { var changemeloc = locsubstr.substring(locsubstr.indexOf("=") + 1, locsubstr.length);//find the newpath for changeme parent.frames[0].location.replace(changemeloc);//change changeme to new path } else {parent.frames[0].location.replace(defaultpath);}//if there isn't a new path, set changeme to default } </script> </head> <body onload = "iframe_src()";> (Note: I have removed a ] where appropriate in the below so the code will show) Code:
URL="http://<my domain>/test.html?view=http://www.domain.com/index.html?from=public_rss"]Link No 1...[/URL Code:
../index.php?pageid=testpage Code:
URL="http://<my domain>/index.php?pageid=testpage?view=http://www.domain.com/index.html?from=public_rss"]Just Testing...[/URL Any help is very much appreciated and thanks! |
#2
|
||||
|
||||
This should be what you want:
Code:
function iframe_src() { find = location.search.match(/view=(.*[^&])/); parent.frames[0].location.replace(find[1] != '' ? find[1] : defaultpath); } |
#3
|
|||
|
|||
Thanks Deceptor but unfortunately I am still getting "Invalid Page Specified" message
|
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|