Some of my iframes include a script...
How can I add this to the iframes module, or is there another way? Without this ability, I can't use SilverStripe - and so far I really like it. Any help?
Thank you,
Steve
<IFRAME title="Search house plans and home plans" id=myFrame frameBorder=0 width=100% height=2000></IFRAME>
<script>
function decodeQuery(query)
{
var params = {}; // prepare the map
if (query.length < 2) // zero characters or single '?' means no parameters
return params;
// cut '?' away:
query = query.slice(1);
var paramList=query.split('&'); // separate parameters
for(var i=0; i<paramList.length; i++) // enumerate them
{
var pair = paramList.split('=');
params[pair[0]]=pair[1];
}
return params;
}
var query=location.search; // get everything after question mark
var params = decodeQuery(query); // and turn into an indexable structure
var p = (params.id) // checking if 'id' is present
? '&action=more_details&id=' + params.id // if present, then ask for more details
: ''; // otherwise - don't.
var iframe = document.getElementById('myFrame');
iframe.src="http://www.sneserver.com/houseplans/index.php?BuilderID=197" + p;
</script>