View Full Version : JavaScript Frames & QueryString

05-30-2006, 03:40 AM
I actually want to create a HTML page which has the capablity of reading a QueryString (x.html?querystring=test) and then using a hidden frame pass on the data to an ASP Script on another server.
For obtaining the QueryString i use the following:-

function getQueryVariable(variable) {
var query = window.location.search.substring(1);
var vars = query.split("&");
for (var i=0;i<vars.length;i++) {
var pair = vars[i].split("=");
if (pair[0] == variable) {
return pair[1];

alert( getQueryVariable("QueryString") );

Now my problem is to create a dynamic frame(hidden) who's location chnges according to the QueryString like

Thanks in Advance

Mr J
06-02-2006, 10:59 PM
If I understand correctly, with


The following would go in sample.asp

<script type="text/javascript">

if (location.search.length > 0){
url = unescape(location.search.substring(1))
document.write('<iframe src="'+url+'" src="blank.htm" style="position:absolute;left:0px;top:-500px;visibility:hidden"></iframe>')


I have an example of usng an hidden iframe here