Forum Moderators: open
http:test.html?you=1&me=2 I got a piece of code that gets the parameters but I don't know how to get it into the iframe.
Attempted use in putting it in the iframe:
<IFRAME id="isFrameSeven" name="isFrameSevenx" src="http://test.html?javascript=getURLParameters()"></IFRAME>
URL Getter Code:
function getURLParameters()
{
var sURL = window.document.URL.toString();
if (sURL.indexOf("?") > 0)
{
var arrParams = sURL.split("?");
var arrURLParams = arrParams[1].split("&");
var arrParamNames = new Array(arrURLParams.length);
var arrParamValues = new Array(arrURLParams.length);
var i = 0;
for (i=0;i<arrURLParams.length;i++)
{
var sParam = arrURLParams[i].split("=");
arrParamNames[i] = sParam[0];
if (sParam[1]!= "")
arrParamValues[i] = unescape(sParam[1]);
else
arrParamValues[i] = "No Value";
}
for (i=0;i<arrURLParams.length;i++)
{
alert(arrParamNames[i]+" = "+ arrParamValues[i]);
}
}
else
{
alert("No parameters.");
}
}
It would go something like this
<script>
<!--
document.open();
document.write('<iframe src="' + getUrl() + '">');
document.writeln('<\/iframe>')
-->
</script>
<noscript>
<iframe src="url"></iframe>
</noscript>
NOTES
1) When embedded in a page, scripts should be enclosed within html comments as shown above.
2) When placed in a string, the / character should be escaped using the \ character. This is not strictly necessary (I think) when the script is external to the page but is harmless.
3) In order to allow your page to work without javascript, you should include a <noscript> version as above.
4) DON'T get clever and try to use a single </iframe> to close both versions. This may work on some browsers but will break on others and your code will not validate.
Kaled.
<DIV id="frameSeven">
<IFRAME id="isFrameSeven" name="isFrameSevenx" src="javascript:window.location='http://netrecon/cgi-bin/applicationData.pl?'+parent.delineate2(document.HiddenURL.parameters.value)" frameBorder=0 marginwidth="0" marginheight="0" vspace="0" hspace="0" style="overflow:visible; width:100%; height:82%; display:block"></IFRAME>
</DIV> this is what I am trying that is not working now!
<FORM NAME="HiddenURL">
<INPUT TYPE="hidden" NAME="parameters" SIZE="35">
</FORM>
<SCRIPT LANGUAGE="javascript">
var locate = window.location
document.HiddenURL.parameters.value = locate
var text = document.HiddenURL.parameters.value
function delineate2(str){
point = str.lastIndexOf("?");
return(str.substring(point+1,str.length));
}
document.write("?" +delineate2(text));
</SCRIPT> here is the script it is calling, the iframe url seems unable to be changed with javascript! Can anyone help on this one? I have to do it in the iframe src, there are tabs calling this hidden div into play when you click the links above and it stops working if i put the script in that ahref