Click to See Complete Forum and Search --> : set (external) text of layer


Bungholio
03-21-2003, 12:25 PM
Hi, thanks for looking :)

I am using an updated Set Text of Layer i picked up at the DWexchange. (its updated for better nn6 compatibility)

Anyways, it's a pretty simple script, although I am no javascript coder....I would like to modify it a bit, so that i can use text in an external file, instead of in the function call.

heres what im talking about

(note: there is more script then this, but it is just FindObj sutff that DW uses)

function MM_setTextOfLayer(objName,x,newText) {
var obj = (document.getElementById) ? tmt_findObj(objName) : MM_findObj(objName);
if (obj!=null) with (obj)
if (document.layers) {document.write(unescape(newText)); document.close();}
else innerHTML = unescape(newText);
}

as you can see, it writes text into a layer, here is the link;

onMouseOver="MM_setTextOfLayer('mid-col','','Blah Blah Blah')

anyways, all i want to do is change Blah Blah Blah to and external .txt, i.e.

onMouseOver="MM_setTextOfLayer('mid-col','','myText.htm')

Hope this can be done, ive got my fingers crossed :)

Thanks,
Al

pyro
03-21-2003, 12:32 PM
With javascript, no that cannot be done. Javascript has no file i/o. You can however do it with server side languages. This link may help you: http://www.infinitypages.com/research/divinclude.php

Bungholio
03-21-2003, 12:33 PM
woops, sorry forgot to mention, im doing this cause my client payed for cheap bull**** hosting, and they cant use and languages or db's .. :(

pyro
03-21-2003, 12:34 PM
Than your answer is no...

Bungholio
03-21-2003, 12:38 PM
i have seen it done...

http://dhtmlnirvana.com/external/externalex.html

i would use that but the layers dont resize if your browser resizes...unless you know how i could add that?

pyro
03-21-2003, 12:43 PM
It would appear that that page is using an iFrame...

Bungholio
03-21-2003, 12:51 PM
In that example, the javascript loads the pages from the iframe to the layer 'contentLYR' ... why? well becuase when using an iframe or some of the 'url into layer extensions' from MM.com, you have to specify the height of the layer or iframe. If you did so and the ocntent was greater then the frame or layer, there woudl be scrollbars.

However, if you do this in the technic as the example, the layer expands downwards

the tutorial is

http://www.dhtmlnirvana.com

DHTML>External HTML Loader>

anyways, again, my whole reason for this is so that the page can expand not have any iframes with scroll bars...Im working on a flexible CSS type layout...

I have sent an email to the creator asking about how to get the layer to resize when the browser resizes, but he says it takes him a while to respond, and unfortunately im in kinda a rush (who isnt?)

Anyways, you will notice on the actual homepage
http://www.dhtmlnirvana.com
that the main content layer DOES resize....

Any insight on this?
Thanks again,
Al