如何使用Javascript获取当前NotesDocument?

如何使用Javascript获取当前NotesDocument?,javascript,web,lotus-notes,Javascript,Web,Lotus Notes,在lotusnotes项目中,使用QueryOpen方法自动访问当前文档非常简单,例如,从NotesUIDocument提取当前文档,这是一个参数 Sub Queryopen(Source As Notesuidocument, Mode As Integer, Isnewdoc As Variant, Continue As Variant) //Here I get the document Dim doc as NotesDocument Set doc = So

在lotusnotes项目中,使用QueryOpen方法自动访问当前文档非常简单,例如,从NotesUIDocument提取当前文档,这是一个参数

Sub Queryopen(Source As Notesuidocument, Mode As Integer, Isnewdoc As Variant, Continue As Variant)

    //Here I get the document
    Dim doc as NotesDocument
    Set doc = Source.document

End Sub

除了在web上使用Javascript之外,我如何做同样的事情?当然,在QueryOpen方法中不一定

如果您只想访问文档字段,那么这是一项简单的任务:

var doc = document.forms[0];
var yourfield = doc.YourFieldName; // take care: fieldname is case sensitive
// to get a field- value;
var theValue = yourfield.value;
// to set a field value
yourfield.value = "AnotherValue";

在XPages中,这是完全不同的,因为有JavaScript类与NotesDocument类具有相似/相同的方法/属性,以模拟LotusScript行为

您希望实现什么?要访问“字段”,只需执行var doc=document.forms[0]。。。并按doc.FieldName.value访问字段。。。但在xpages中,这将是完全不同的different@Tode文档。表单[0]有效。如果您愿意,将其作为答案发布,我会将其设置为最佳答案只是为了澄清,通过JavaScriptDOM访问字段与访问当前NotesDocument不同。这实际上更类似于访问当前的NotesUIDocument并使用fieldGetText。这是一个很好的观点(如果知道LotusScript中前端和后端的区别的话)。这比我想象的要简单得多。我不熟悉LotusWeb开发,但使用JS。很快,我将使用XPages,它看起来功能强大且简单。