<script>
/* source parameters */
function GetURLParameter(sParam)
{
var sPageURL = window.location.search.substring(1);
var sURLVariables = sPageURL.split('&');
for (var i = 0; i < sURLVariables.length; i++)
{
var sParameterName = sURLVariables[i].split('=');
if (sParameterName[0] == sParam)
{
return sParameterName[1];
}
}
}
var mysrc = GetURLParameter("externalsrc");
if(mysrc == null) {
mysrc='another_site';
}
var objHidden = document.getElementById("externalsrc");
objHidden.value = mysrc;
</script>
Before, I used to use the above code when I hard coded the form code directly in the HTML page of my site. The above code easily checks url parameters from the address bar and gives the value of externalsrc to a form field's value. Now, I created a portable iframe widget that can be used elsewhere externally. I'd like to update the value of <input type="hidden" externalsrc="" value"" />
from the iframe's extsrc argument.
Here's an example of the iframe code:
<iframe src="http://www.example.com/joinuswidget.html?externalsrc=mywidget" marginheight="0" marginwidth="0" frameborder="0" height="350" scrolling="no" width="190"></iframe>
I'd like my form's externalsrc's value to be "mywidget" taken directly from the iframe's source. Is it possible?
Thanks,