how to handle javascript whitin notes ?

Hi experts,

I did found a few javascripts I want to use in the databases I'm builing (for web purposes), but I don't know how to "import" those scripts into the application.

The remark with those scripts is saying to:

first - Copy the coding into the HEAD of your HTML document

second - Add the onLoad event handler into the BODY tag

third - Put the last coding into the BODY of your HTML document  

How do I do this in Notes R5 ?

Greetings,

Bob
LVL 1
oosterbaanAsked:
Who is Participating?
 
zvonkoConnect With a Mentor Commented:
Hello Bob,

it seams Heman has overreadn the R5 chars :-)

In R5 you need for JavaScript no passtrough tags like [ and ]
To use JavaScript simply open the form where to embed JavaScript in LotusDesigner.
When form opened AND cursor in forms body, than you can see in design properties window (not the property dialog) a set of attributes like "WebQueryOpen", "WebQuerySave",... and a lot of other attributes.
You need two of them: "JSHeader" and "onLoad". Thery are there, look for them...

Into JSHeader place your "first -CopythecodingintotheHEADofyourHTMLdocument" part, but without "<SCRIPT.." and "</SCRIPT>" lines. This two lines are generated for you by Domino.
Into onLoad place your "second-AddtheonLoadeventhandlerintotheBODYtag" part. Here also extract only the string from quotes and place it in onLoad event. The quotes will be generated by Domino.

The last part, your "third-PutthelastcodingintotheBODYofyourHTMLdocument " part, you have to place into the form. Than you have to mark it as HTML. The best way to mark it as HTML is to select this text in the form and to click on this menue option: Text->PassThruHTML
The selected text get after this selection an inverted color to signal that it is now HTML and not simply text.

That should do the trick.

Good luck,
zvonko

0
 
HemanthaKumarCommented:
Create a field called $$HTMLHead a computed for display field and paste all of the head js code (watch quotes).

[<Body onload="make a call to js function">]

Then paste or code all of ur html within the [] like this for eg:

[<input type=button name="xxx" value="yyy" onClick="do something">]


Just use your form as html editor

In R5 you can use pages to hold js code and import it into the script tag. But the above method would be simple to start with.

~Hemanth

0
 
oosterbaanAuthor Commented:
Please help me out...

The code that I found starts like this:

<HEAD>

<SCRIPT LANGUAGE="JavaScript">

<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! http://javascript.internet.com -->

<!-- Begin
function mklist(n)
{
  this.length=n;
  for (var c=1 ; c <= n ; c++) {
    this[c]=0;
  }
  return this;
}

And ends with this:


    window.clearTimeout(window.config.timer);
    window.config.timer=window.setTimeout('sbprint()',window.config.delay);
  }
}
//  End -->
</script>

What do I need to paste into the $$HTMLHead field ? because when I paste this code, error message's appears.

Do I need to add the [ character somewhere or leave lines out ?

Greetings,

Bob
0
Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

 
HemanthaKumarCommented:
Instead of using $$HTMLHead, paste the code directly into the form like this

[<HTML>
<HEAD>

<SCRIPT LANGUAGE="JavaScript">

<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! http://javascript.internet.com -->

<!-- Begin
function mklist(n)
{
 this.length=n;
 for (var c=1 ; c <= n ; c++) {
   this[c]=0;
 }
 return this;
}

And ends with this:


   window.clearTimeout(window.config.timer);
   window.config.timer=window.setTimeout('sbprint()',window.config.delay);
 }
}
//  End -->
</script>
</HEAD>

<Body onLoad="mklist()">
Any HTML code here....
</Body>
</HTML>]

0
 
CRAKCommented:
Hemanth,
Why the $$HTMLhead-field? He's using R5....

All he needs is copy the actual JS-code:

function mklist(n)
{
 this.length=n;
 for (var c=1 ; c <= n ; c++) {
   this[c]=0;
 }
 return this;
}
...
etc.
...
   window.clearTimeout(window.config.timer);
   window.config.timer=window.setTimeout('sbprint()',window.config.delay);
 }
}

and paste it in the JS header-event of a form or page. I agree with you that the $$HTMLhead-field works to -even on R4.x servers-, but this is much easier!
Additional advantages: you dan't have to worry about those quotes and the different colors help to make it readable.


Similar to that: paste "mklist()" (without quotes) in the onLoad event of the forms or pages onLoad-event.

0
 
zvonkoCommented:
Hello CRAK <|;-)
0
 
CRAKCommented:
Hi zvonko!
I see you're reaching for your "first" T-shirt again? You're going fast!
How much time do you spend on EE anyway?
0
 
HemanthaKumarCommented:
True, but I want to keep it simple. And also downward compatibility ;-)
0
 
zvonkoCommented:
You think I do this for this fantasy T-shirts (ha ha ha)...
untill now I got only ONE!!!

How much t-****s do you have CRAK? ;-)

...anyway you are right: I spend too much time here (still I wonder when Heman is sleeping :-))
0
 
oosterbaanAuthor Commented:
One more last question,

I have tried zvonko's option with the JS header and Onload attributes, and this is working fine, but is it possible to add more the one javascript into these attributes ?

Greetings,

Bob
0
 
CRAKCommented:
Sure you can: put every instruction on a new line.
If you want to do it right, close every line with a semi-colon (";").
In fact you could even use the semi-colons, without newline:
alert('statement 1'); alert('statement 2')

If things get complicated you could add new functions in JS Header, and address those in the form events:

JS Header:
function alerts(parm)
{
 alert(parm);
 alert('statement 1');
 alert('statement 2');
}

onLoad:
alerts('1st time');
alerts('2nd time');
0
 
CRAKCommented:
zvonko,
I got over 5000 pt for notes just about two weeks ago. I'm waiting for the "T-shirt problems" (see "what's new") to get solved now, so I can finally see if it's worth wearing it.
Next target: top 15!?
Pitty this guy "stamp" is still there.... I wonder who's on #16!  ;-))
0
 
zvonkoCommented:
...we will see (said the blind man ;-))
0
 
oosterbaanAuthor Commented:
Thanks guys
0
 
zvonkoCommented:
Bob, thank you for the points ;-)
0
All Courses

From novice to tech pro — start learning today.