/**
**/
:-object memberjs : [jsilib].
var output.
main :-
get_window(Window),
get_member(Window, 'document', Document),
get_member(Document, example, Example),
get_member(Example, output_area, OutputArea),
output := OutputArea,
get_member(Document, lastModified, LastModified),
show('~npage last modified ~w~n', [LastModified]),
get_member(Document, referrer, Referrer),
show('referrer ~w~n', [Referrer]),
get_member(Document, bgColor, Color),
show('the document color = ~w~n', [Color]),
set_member(Document, bgColor, cyan),
get_member(Document, bgColor, NewColor),
show('new background color = ~w~n', [NewColor]),
get_member(Document, applets, Applets),
get_member(Applets, length, Length),
show('applets length value = ~w~n', [Length]),
get_member(Example, input_area, InputArea),
show('input_area ref = ~w~n', [InputArea]),
get_member(InputArea, type, InputType),
show('the input type = ~w~n', [InputType]),
get_member(InputArea, value, InputValue),
show('and the input value = ~w~n', [InputValue]),
set_member(InputArea, value, '......'),
get_member(InputArea, value, NewInputValue),
show('the new input value = ~w~n', [NewInputValue]),
option_list(Window, Example).
option_list(Window, Example) :-
show('~n', []),
get_member(Example, language, Selects),
get_member(Selects, options, Options),
get_member(Options, length, Length),
get_member(Options, selectedIndex, Index),
show('number of options = ~w~n', [Length]),
show('selected index = ~w~n', [Index]),
option_eval(0, Length, Window).
%% option_slot(0, Length, Selects, Options). %% 1r18K: get_slot/3
option_eval(I, L, Window) :-
I < L,
!,
N is I + 1,
format_to_atom(Option, 'document.example.language.options[~w].value', [I]),
%% eval(Window, Option, Value), %% +netscape, -explorer
%% function evaluate_string(code)
%% { return eval('' + code); } :
call(Window, evaluate_string, [Option], Value), %% +netscape, +explorer
show('eval ~w = ~w~n', [I, Value]),
option_eval(N, L, Window).
option_eval(_do_, _not_, _fail_).
/**
option_slot(I, L, Selects, Options) :-
I < L,
!,
N is I + 1,
%% both "Selects" and "Options" work
%% under netscape (but not explorer):
get_slot(Options, I, TheSlot), %% +netscape, -explorer
get_member(TheSlot, value, SValueI),
show('slot ~w = ~w~n', [I, SValueI]),
option_slot(N, L, Selects, Options).
option_slot(_do_, _not_, _fail_, _here_).
**/
show(Format, Arguments) :-
%% yet another example of the
%% get / set member methods :
get_member(output, value, Area),
format_to_atom(Line, Format, Arguments),
format_to_atom(Text, '~w~w', [Area,Line]),
set_member(output, value, Text).
:-end_object memberjs.
/**
**/