Page 1 of 1

How to insert SpiderBasic code into an exhisting html file?

Posted: Thu Jul 28, 2016 2:14 pm
by Alberto
I' m a very happy user of PureBasic and I want to know if is it possible to insert SpiderBasic code into an exhisting html file made by another program (Dreamweaver for example). I imagine two ways of inserting the SpiderBasic code:

1) There is a rectagle area in the html page that it's a SpiderBasic Window

2) The background of the html page it's a SpiderBasic Window with #PB_Window_Background flag.

I failed in both of these two way.
When I try to mix html elements and spiderbasic elements on the same page the browser first shows the html elements then redraw the page and shows only the spiderbasic elements. I tried to move the <div class="flat" id="spiderbody"> in a different position (inside the <body> tag for example) but I had no success.

I haven't found an example with this integration. All the included examples only contains html elements that are totally made by SpiderBasic.

Any suggestion?

Thanks in advance
Alberto

Re: How to insert SpiderBasic code into an exhisting html fi

Posted: Wed Sep 14, 2016 1:35 pm
by SparrowhawkMMU
You might be able to use an <iframe>

for example:

Code: Select all

 <iframe id="myiframe" src="http://my-spiderbasicsite.com"></iframe> 
You can then use the contentDocument peoprerty of the iframe to manipulate it via the DOM, eg (Javascript from parent doc)

Code: Select all

var myframe = document.getElementById("myiframe");
var mydoc   = (myframe.contentWindow || myframe.contentDocument);
if (mydoc.document) {
    mydoc = mydoc.document;
}
mydoc.body.style.backgroundColor = "powderblue";
PS - not tested, but in principle this should work. It's adapted fomr a W3C example so should be OK

Re: How to insert SpiderBasic code into an exhisting html fi

Posted: Thu Sep 15, 2016 12:24 pm
by Alberto
Thank you SparrowhawkMMU.

I've tested it and works good.
This is what I was looking for.

Thanks again
Alberto