Hello,
I have this issue on how to implement this scrollTo() method in my existing javascript codes.
The function is I have a form, and when I update my form it has preview. And I want it every time I update it scroll to to the preview.
I have this two javascript functions:
function highlightPreview(idName)
{
var undef;
var myPreview = arrElements[idName]._preview;
if (myPreview != undef)
{
myPreview.style.background = "#ffff99";
arrElements[idName].scrollTo();
}
}
function updatePreview(idName, keepBackground)
{
var undef;
var myElement = arrElements[idName]._element;
var myPreview = arrElements[idName]._preview;
var myBackground = arrElements[idName]._background;
if (myPreview != undef)
{
if (!keepBackground) myPreview.style.background = myBackground;
if (myElement.name.search(/\\_cmd/) == -1)
myPreview.innerHTML = myElement.value;
arrElements[idName].scrollTo();
else
myPreview.value = myElement.value;
}
}
Here is my HTML:
<tr class="Row">
<td class="LabelCol" width="25%">'Used Password' Message:</td>
<td class="ValueCol" width="75%" colspan="2">
<textarea
name="xp_txtUsed"
id="xp_txtUsed"
cols="64"
rows="6"
onFocus="highlightPreview(this.name)"
onBlur="updatePreview(this.name)"
onChange="updatePreview(this.name)"
onKeyUp="updatePreview(this.name, true)"
><%= FormVals.Item("xp_txtUsed") %></textarea>
</td>
</tr>
My objective is apply scrollTo() method inorder for me to see the preview scroll to when I updated the form.
Please let me know how to do this.
Thanks in advanceā¦