Forum > Networking and Web Programming

(SOLVED) fphttpserver and External JavaScript files

(1/2) > >>

xinyiman:
hello guys, how can I include in a project fpweb of JavaScript libraries? I would use the DHTMLX framework. To be clear in my response I go to insert this piece of code.


--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>        <meta http-equiv="X-UA-Compatible" content="IE=edge"/>        <link rel="stylesheet" type="text/css" href="dhtmlx/codebase/fonts/font_roboto/roboto.css"/>        <link rel="stylesheet" type="text/css" href="dhtmlx/codebase/dhtmlx.css"/>        <script src="dhtmlx/codebase/dhtmlx.js"></script> 

How do I make sure that my standalone server files such recoveries (placed in the folder where is the executable?

Thanks

xinyiman:
No idea to solve? I wonder others who use this component as insert external resources!

xinyiman:
I created a working example. CHe if completed and launched, when the page loads

localhost: 8080

The code that does this is:


--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---      myhtml:='<html>';     myhtml:=myhtml + '<head><title> Test web </title><head>';     myhtml:=myhtml + '<body onload="alert(''Hello World'');">Test web</body>';     myhtml:=myhtml + '</html>';       
launches an alert that says Hello World. Now I wish they would change the code so



--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---      myhtml:='<html>';     myhtml:=myhtml + '<head><title> Test web </title>';     [b]myhtml:='<script type="text/javascript" src="myjslib\miojavascript.js"></script><head>';[/b]     myhtml:=myhtml + '<body onload="MyFunction();">Test web</body>';     myhtml:=myhtml + '</html>';       
Where MyFunction (); It is contained in the Javascript file. Who tells me how to do?

I attach as upfront with the javascript file already created

derek.john.evans:
If you are using TFPHTTPServer, then there is an example in:

\lazarus\fpc\3.0.0\source\packages\fcl-web\examples\httpserver

You want to map a HTTP request to a local file, which is then served.

xinyiman:
Thank you  ;)

Navigation

[0] Message Index

[#] Next page

Go to full version