Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
cduce
cduce
Commits
d4ebddb1
Commit
d4ebddb1
authored
Jul 10, 2007
by
Pietro Abate
Browse files
[r2004-12-28 14:22:09 by afrisch] Demo
Original author: afrisch Date: 2004-12-28 14:22:09+00:00
parent
33075979
Changes
2
Hide whitespace changes
Inline
Side-by-side
web/demo.js
View file @
d4ebddb1
function
clearreq
(
pr
)
{
document
.
getElementById
(
pr
+
"
req
"
).
value
=
""
;
}
{
document
.
getElementById
(
pr
+
"
edit
"
).
value
=
""
;
}
function
show_result
(
pr
,
res
)
{
document
.
getElementById
(
pr
+
"
res
"
).
innerHTML
=
res
;
}
...
...
@@ -8,8 +8,12 @@ function clearres(pr)
{
show_result
(
pr
,
""
);
}
function
defreq
(
pr
)
{
document
.
getElementById
(
pr
+
"
req
"
).
value
=
document
.
getElementById
(
pr
+
"
def
"
).
value
;
}
{
var
req
=
document
.
getElementById
(
pr
+
"
req
"
);
var
edit
=
document
.
getElementById
(
pr
+
"
edit
"
);
var
def
=
document
.
getElementById
(
pr
+
"
def
"
);
edit
.
value
=
def
.
value
;
req
.
innerHTML
=
def
.
value
;
}
function
submit
(
pr
)
{
var
xmlhttp
=
new
XMLHttpRequest
();
...
...
@@ -19,4 +23,27 @@ function submit(pr) {
}
show_result
(
pr
,
"
Computing...
"
);
xmlhttp
.
send
(
document
.
getElementById
(
pr
+
"
req
"
).
value
);
}
function
editable
(
pr
,
b
)
{
var
ct
=
document
.
getElementById
(
pr
+
"
container
"
);
var
req
=
document
.
getElementById
(
pr
+
"
req
"
);
var
edit
=
document
.
getElementById
(
pr
+
"
edit
"
);
var
btn
=
document
.
getElementById
(
pr
+
"
btn
"
);
var
btnclear
=
document
.
getElementById
(
pr
+
"
btnclear
"
);
if
((
req
.
style
.
visibility
==
'
hidden
'
)
||
(
b
==
"
init
"
))
{
req
.
innerHTML
=
edit
.
value
;
req
.
style
.
visibility
=
'
visible
'
;
edit
.
style
.
visibility
=
'
hidden
'
;
btnclear
.
style
.
visibility
=
'
hidden
'
;
btn
.
value
=
"
Edit
"
;
ct
.
style
.
height
=
req
.
offsetHeight
;
}
else
{
req
.
style
.
visibility
=
'
hidden
'
;
edit
.
style
.
visibility
=
'
visible
'
;
btnclear
.
style
.
visibility
=
'
visible
'
;
btn
.
value
=
"
Unedit
"
;
ct
.
style
.
height
=
edit
.
offsetHeight
;
}
}
\ No newline at end of file
web/site.cd
View file @
d4ebddb1
...
...
@@ -261,15 +261,20 @@ let demo(no : Int)(txt : String) : H:Flow =
<
tr
>
[
<
td
style
=
"
width:50%
"
>
[
(
button
"
Evaluate
"
(
"
submit('
"
@
n
@
"
');
"
))
(
button
"
Clear
"
(
"
clearreq('
"
@
n
@
"
');
"
))
(
button
"
Default
"
(
"
defreq('
"
@
n
@
"
');
"
))
<
input
type
=
"
submit
"
id
=
(
n
@
"
btnclear
"
)
value
=
"
Clear
"
onclick
=
(
"
clearreq('
"
@
n
@
"
');
"
)
>
[]
]
<
td
style
=
"
width:50%
"
>
[
<
input
id
=
(
n
@
"
def
"
)
type
=
"
hidden
"
value
=
txt
>
[]
(
button
"
Clear
"
(
"
clearres('
"
@
n
@
"
');
"
))
]
]
<
tr
>
[
<
td
valign
=
"
top
"
>
[
<
textarea
id
=
(
n
@
"
req
"
)
cols
=
"
60
"
rows
=
"
25
"
>
txt
]
<
td
valign
=
"
top
"
>
[
<
div
style
=
"
position:relative; height:100px;
"
id
=
(
n
@
"
container
"
)
>
[
<
pre
style
=
"
position:absolute; z-index:2; height:auto;
"
id
=
(
n
@
"
req
"
)
>
[]
<
textarea
id
=
(
n
@
"
edit
"
)
cols
=
"
60
"
rows
=
"
25
"
style
=
"
position:absolute; z-index:1; height:auto;
"
>
txt
]
]
<
td
valign
=
"
top
"
>
[
<
div
id
=
(
n
@
"
res
"
)
>
[]
]
]
]
]
(
*
Main
transformation
function
*
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment