Jump to:

17452 Posts in 4473 Topics by 1971 members

Archive

SilverStripe Forums » Archive » Extended iFrames

Our old forums are still available as a read-only archive.

Moderators: martimiz, Sean, biapar, Willr, Ingo, simon_w

Page: 1
Go to End
Author Topic: 761 Views
  • steve_nyhof
    Avatar
    Community Member
    224 Posts

    Extended iFrames Link to this post

    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>

    761 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.