This seems simple enough but nothing I try has been working, it's getting pretty frustrating.
Here is the Javascript:
function vf(loc) {
var x = document.getElementById('frame').src;
var n = x.indexOf("?f");
var f = x.substring(n, n + 2);
var nn = x.indexOf("?t");
var t = x.substring(nn, nn + 1);
var f = loc;
var link = "/Home/VidList?f=" + f + "?t=" + t;
document.getElementById('frame').src = link;
}
And the HTML:
<a href='#' onclick="vf('MP')">Most Popular</a>
<iframe id="frame" src="/Home/VidList/"></iframe>
It works fine if I change it to:
document.getElementById('frame').src = "test";
Or anything else, and it works and shows the correct link of the text if I do something like:
document.getElementById('test').innerHtml = link;
But for some reason settin the .src to that variable does not work. Simply nothing happens and the src is not changed at all.
Thank you in advance for your time.
EDIT:
Upon further investigation it looks like the "?" character is the offender, removing that from the string allows it to work fine, how can I get it to allow the question mark?