+
1
|
list
|
skin
|
login
|
editor
α-wwwiki
::
include
user:none
(1094 bytes)
_h1 include _p Code can be written in a wiki page and used in another one. It can't be an external link to prevent serious security flaw ! In this example, the page [[someJS]] contains the definition of 3 new lambdatalk functions : square, sqrt and fac. {pre {input {@ type="submit" value="include someJS" onclick="°° var js = document.createElement('script'); js.src = 'pages/someJS.txt'; document.body.appendChild( js ); this.value = 'OK, someJS is included !'; this.disabled='disabled'; °°"}} {input {@ id="input" type="text" value="" placeholder="enter a number"}} {input {@ type="submit" value='compute square' onclick="°°getId('output1').innerHTML = sqr(getId('input').value);°°"}}:{span {@ id="output1"}} {input {@ type="submit" value='compute sqrt' onclick="°°getId('output2').innerHTML = sqrt(getId('input').value);°°"}}:{span {@ id="output2"}} {input {@ type="submit" value='compute factorial' onclick="°°getId('output3').innerHTML = fac(getId('input').value);°°"}}:{span {@ id="output3"}} } _h3 code _p Open editor to see the code.