By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,712 Members | 2,116 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,712 IT Pros & Developers. It's quick & easy.

I have these two short conflicting scripts -- help!

P: n/a
Hello, I have these two scripts, where the first one is being canceled
out by the second, they work independently, but not together (they are
a auto-tab and form box character counter script) -- hopefully one can
see how they are conflicting and fix a solution so they can work and
mesh together. It seems the second script is canceling out the first
-- so I am not sure what the problem is. Thanks for anyone's help!
:))

Sincerely,

%julia%
<script>
function autotab(original,destination){
if (original.getAttribute&&original.value.length==ori ginal.getAttribute("maxlength"))
destination.focus()
}
</script>

<script type="text/javascript">
function showRemaining(formElement) {
var theForm = formElement.form;
var remainingDisplay = formElement.name + 'Remaining';
theForm.elements[remainingDisplay].value = formElement.maxLength -
formElement.value.length;
}
</script>
Jul 20 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Hi Julia,

Not really enough information to say for sure.
I'm guessing you're using something like an onKeyUp event on the form
element to launch both functions.
You can do this by separating the two function calls by a semicolon e.g.
onKeyUp="autotab(parm1,parm2);showRemaining(parm)" .
What you can't do is have two separate onKeyUp event parameters defined in
the same tag (though event bubbling permits other ways of launching two
functions on the same event).

Hope this helps,
Regards,
Chris.

"Julia Briggs" <ju*******@yahoo.com> wrote in message
news:c4**************************@posting.google.c om...
Hello, I have these two scripts, where the first one is being canceled
out by the second, they work independently, but not together (they are
a auto-tab and form box character counter script) -- hopefully one can
see how they are conflicting and fix a solution so they can work and
mesh together. It seems the second script is canceling out the first
-- so I am not sure what the problem is. Thanks for anyone's help!
:))

Sincerely,

%julia%
<script>
function autotab(original,destination){
if (original.getAttribute&&original.value.length==ori ginal.getAttribute("maxlen
gth")) destination.focus()
}
</script>

<script type="text/javascript">
function showRemaining(formElement) {
var theForm = formElement.form;
var remainingDisplay = formElement.name + 'Remaining';
theForm.elements[remainingDisplay].value = formElement.maxLength -
formElement.value.length;
}
</script>

Jul 20 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.