To insert the JavaScript code

Microsoft HTML Help

To insert the JavaScript code

Insert the following JavaScript code between the <HEAD> start and end tags of an HTML file.

function functionOn(idVar){
idVar.style.attribute="value";
}

function functionOff(idVar){
idVar.style.attribute="value";
}

Where functionOn is the name of the JavaScript function that changes the style when a user moves their cursor over the section, and functionOff is the script that is called when the user moves their cursor off the section. attribute="value" represents a style attribute that changes when the script is called. idVar is the ID of the element.

Example

The following is the JavaScript code used for the dynamic "Go" link in the HTML Help documentation:

function liteGo(spNo){
spNo.style.background="#cc0033";
spNo.style.color="#FFFFFF";
}

function liteOff(spNo){
spNo.style.background="transparent";
spNo.style.color="#000000";
}

Note

  • You can use a global script file to make it easier to maintain scripts that are used on many pages.