Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #21700 > unrolled thread
| Started by | Ed Jay <edMbj@aes-intl.com> |
|---|---|
| First post | 2013-10-23 02:30 -0700 |
| Last post | 2013-10-23 10:16 -0700 |
| Articles | 7 — 3 participants |
Back to article view | Back to comp.lang.javascript
Can I access event parameters? Ed Jay <edMbj@aes-intl.com> - 2013-10-23 02:30 -0700
Re: Can I access event parameters? JJ <duh@nah.meh> - 2013-10-23 19:35 +0700
Re: Can I access event parameters? Ed Jay <edMbj@aes-intl.com> - 2013-10-23 07:18 -0700
Re: Can I access event parameters? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2013-10-23 16:37 +0100
Re: Can I access event parameters? Ed Jay <edMbj@aes-intl.com> - 2013-10-23 09:09 -0700
Re: Can I access event parameters? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2013-10-23 17:43 +0100
Re: Can I access event parameters? Ed Jay <edMbj@aes-intl.com> - 2013-10-23 10:16 -0700
| From | Ed Jay <edMbj@aes-intl.com> |
|---|---|
| Date | 2013-10-23 02:30 -0700 |
| Subject | Can I access event parameters? |
| Message-ID | <uj5f69lc535n3jb8s31mf3vdrv9imagmte@4ax.com> |
HTML:
<input id="threshold" type="range" min=0 max=255 step=1 value="0"
onmouseUp="change_values('thr');"
onchange="document.getElementById('base_box').innerHTML= (var1+
this.value*(var2 - var1)/255).toFixed(1);"
>
I'm trying to dynamically change the values of var1 and var2 in the above
using javascript. I don't have a clue how. I'd be grateful for the
solution, but I'll be just as grateful knowing whether it can or can't be
done.
Thanks.
--
Ed Jay (remove 'M' to reply by email)
Win the War Against Breast Cancer.
Knowing the facts could save your life.
http://www.breastthermography.info
[toc] | [next] | [standalone]
| From | JJ <duh@nah.meh> |
|---|---|
| Date | 2013-10-23 19:35 +0700 |
| Message-ID | <19bcwk5gwh9r2$.18igiwbz9wycw.dlg@40tude.net> |
| In reply to | #21700 |
On Wed, 23 Oct 2013 02:30:30 -0700, Ed Jay wrote:
> HTML:
> <input id="threshold" type="range" min=0 max=255 step=1 value="0"
> onmouseUp="change_values('thr');"
>
> onchange="document.getElementById('base_box').innerHTML= (var1+
> this.value*(var2 - var1)/255).toFixed(1);"
>>
> I'm trying to dynamically change the values of var1 and var2 in the above
> using javascript. I don't have a clue how. I'd be grateful for the
> solution, but I'll be just as grateful knowing whether it can or can't be
> done.
>
> Thanks.
Where have you defined var1 and var2?
If they're local variables, add a function that can access them into the
owner object/function, and make the function callable from global context.
[toc] | [prev] | [next] | [standalone]
| From | Ed Jay <edMbj@aes-intl.com> |
|---|---|
| Date | 2013-10-23 07:18 -0700 |
| Message-ID | <9emf695adfh69e0mq7kgr8logbevlmmh4c@4ax.com> |
| In reply to | #21701 |
JJ wrote:
>On Wed, 23 Oct 2013 02:30:30 -0700, Ed Jay wrote:
>> HTML:
>> <input id="threshold" type="range" min=0 max=255 step=1 value="0"
>> onmouseUp="change_values('thr');"
>>
>> onchange="document.getElementById('base_box').innerHTML= (var1+
>> this.value*(var2 - var1)/255).toFixed(1);"
>>>
>> I'm trying to dynamically change the values of var1 and var2 in the above
>> using javascript. I don't have a clue how. I'd be grateful for the
>> solution, but I'll be just as grateful knowing whether it can or can't be
>> done.
>>
>> Thanks.
>
>Where have you defined var1 and var2?
They're both values taken from other input (text) elements.
>
>If they're local variables,
They're global.
> add a function that can access them into the
>owner object/function, and make the function callable from global context.
This is where I'm lost. I can fetch the values in javascript without an
issue. It's the syntax for plugging them into the HTML element/event that
I'm in the dark over..
--
Ed Jay (remove 'M' to reply by email)
Win the War Against Breast Cancer.
Knowing the facts could save your life.
http://www.breastthermography.info
[toc] | [prev] | [next] | [standalone]
| From | Ben Bacarisse <ben.usenet@bsb.me.uk> |
|---|---|
| Date | 2013-10-23 16:37 +0100 |
| Message-ID | <0.ffd8e07ded3d8248f76e.20131023163753BST.87d2mwdmlq.fsf@bsb.me.uk> |
| In reply to | #21702 |
Ed Jay <edMbj@aes-intl.com> writes:
> JJ wrote:
>
>>On Wed, 23 Oct 2013 02:30:30 -0700, Ed Jay wrote:
>>> HTML:
>>> <input id="threshold" type="range" min=0 max=255 step=1 value="0"
>>> onmouseUp="change_values('thr');"
>>>
>>> onchange="document.getElementById('base_box').innerHTML= (var1+
>>> this.value*(var2 - var1)/255).toFixed(1);"
>>>>
>>> I'm trying to dynamically change the values of var1 and var2 in the above
>>> using javascript. I don't have a clue how. I'd be grateful for the
>>> solution, but I'll be just as grateful knowing whether it can or can't be
>>> done.
<snip some advice>
> This is where I'm lost. I can fetch the values in javascript without an
> issue. It's the syntax for plugging them into the HTML element/event that
> I'm in the dark over..
But so am I -- I need more information. "Plugging in" is very vague,
and "the HTML element/event" even more so. Back up a bit: what are you
trying to do?
--
Ben.
[toc] | [prev] | [next] | [standalone]
| From | Ed Jay <edMbj@aes-intl.com> |
|---|---|
| Date | 2013-10-23 09:09 -0700 |
| Message-ID | <8lsf69pp74klkiaefvcaiv27g1iieklt5n@4ax.com> |
| In reply to | #21704 |
Ben Bacarisse wrote:
>Ed Jay <edMbj@aes-intl.com> writes:
>
>> JJ wrote:
>>
>>>On Wed, 23 Oct 2013 02:30:30 -0700, Ed Jay wrote:
>>>> HTML:
>>>> <input id="threshold" type="range" min=0 max=255 step=1 value="0"
>>>> onmouseUp="change_values('thr');"
>>>>
>>>> onchange="document.getElementById('base_box').innerHTML= (var1+
>>>> this.value*(var2 - var1)/255).toFixed(1);"
>>>>>
>>>> I'm trying to dynamically change the values of var1 and var2 in the above
>>>> using javascript. I don't have a clue how. I'd be grateful for the
>>>> solution, but I'll be just as grateful knowing whether it can or can't be
>>>> done.
><snip some advice>
>
>> This is where I'm lost. I can fetch the values in javascript without an
>> issue. It's the syntax for plugging them into the HTML element/event that
>> I'm in the dark over..
>
>But so am I -- I need more information. "Plugging in" is very vague,
>and "the HTML element/event" even more so. Back up a bit: what are you
>trying to do?
I have three range elements. Two are independent and known values, the
third requires the two knowns (the onchange event, above). I'm trying to
dynamically show (output to a span) the changed value of the third range
element.
I've tried triggering an external function with the onchange event, but it
doesn't immediately update the desired output.
I'm seeking the javascript syntax or method that will allow me to address
the parameters of the onchange event, e.g.,
var1 = document.getElementById('var1_box').value;
var2 = document.getElementById('var2_box').value;
How to dynamically assign var1 and var2 to the onchange event?
--
Ed Jay (remove 'M' to reply by email)
Win the War Against Breast Cancer.
Knowing the facts could save your life.
http://www.breastthermography.info
[toc] | [prev] | [next] | [standalone]
| From | Ben Bacarisse <ben.usenet@bsb.me.uk> |
|---|---|
| Date | 2013-10-23 17:43 +0100 |
| Message-ID | <0.a72c19fe5db3b1b67b77.20131023174330BST.87vc0oc4zx.fsf@bsb.me.uk> |
| In reply to | #21705 |
Ed Jay <edMbj@aes-intl.com> writes:
> Ben Bacarisse wrote:
>
>>Ed Jay <edMbj@aes-intl.com> writes:
>>
>>> JJ wrote:
>>>
>>>>On Wed, 23 Oct 2013 02:30:30 -0700, Ed Jay wrote:
>>>>> HTML:
>>>>> <input id="threshold" type="range" min=0 max=255 step=1 value="0"
>>>>> onmouseUp="change_values('thr');"
>>>>>
>>>>> onchange="document.getElementById('base_box').innerHTML= (var1+
>>>>> this.value*(var2 - var1)/255).toFixed(1);"
>>>>>>
>>>>> I'm trying to dynamically change the values of var1 and var2 in the above
>>>>> using javascript. I don't have a clue how. I'd be grateful for the
>>>>> solution, but I'll be just as grateful knowing whether it can or can't be
>>>>> done.
>><snip some advice>
>>
>>> This is where I'm lost. I can fetch the values in javascript without an
>>> issue. It's the syntax for plugging them into the HTML element/event that
>>> I'm in the dark over..
>>
>>But so am I -- I need more information. "Plugging in" is very vague,
>>and "the HTML element/event" even more so. Back up a bit: what are you
>>trying to do?
>
> I have three range elements. Two are independent and known values, the
> third requires the two knowns (the onchange event, above). I'm trying to
> dynamically show (output to a span) the changed value of the third range
> element.
Right so far your code does that.
> I've tried triggering an external function with the onchange event, but it
> doesn't immediately update the desired output.
>
> I'm seeking the javascript syntax or method that will allow me to address
> the parameters of the onchange event, e.g.,
>
> var1 = document.getElementById('var1_box').value;
> var2 = document.getElementById('var2_box').value;
>
> How to dynamically assign var1 and var2 to the onchange event?
Getting there. Some more actual code would help. The trouble is you
don't have the words to describe what you need so you keep saying things
that don't really help.
You have, it seems, two input elements called 'var1_box' and
'var2_box'. Would it be correct to say that when either of these
changes, you want the contents of base_box to change just as if the
range control had changed?
Note I am talking about what should happen, not how. Please describe
what you need in in those terms. If you guess, and think that you need
to "dynamically assign var1 and var2 to the onchange event" you will
just baffle people. That phrase has no meaning to me.
--
Ben.
[toc] | [prev] | [next] | [standalone]
| From | Ed Jay <edMbj@aes-intl.com> |
|---|---|
| Date | 2013-10-23 10:16 -0700 |
| Message-ID | <t20g699rkeu1r5c7hivl3q92e0jlnemugg@4ax.com> |
| In reply to | #21706 |
Ben Bacarisse wrote:
>Ed Jay <edMbj@aes-intl.com> writes:
>
>> Ben Bacarisse wrote:
>>
>>>Ed Jay <edMbj@aes-intl.com> writes:
>>>
>>>> JJ wrote:
>>>>
>>>>>On Wed, 23 Oct 2013 02:30:30 -0700, Ed Jay wrote:
>>>>>> HTML:
>>>>>> <input id="threshold" type="range" min=0 max=255 step=1 value="0"
>>>>>> onmouseUp="change_values('thr');"
>>>>>>
>>>>>> onchange="document.getElementById('base_box').innerHTML= (var1+
>>>>>> this.value*(var2 - var1)/255).toFixed(1);"
>>>>>>>
>>>>>> I'm trying to dynamically change the values of var1 and var2 in the above
>>>>>> using javascript. I don't have a clue how. I'd be grateful for the
>>>>>> solution, but I'll be just as grateful knowing whether it can or can't be
>>>>>> done.
>>><snip some advice>
>>>
>>>> This is where I'm lost. I can fetch the values in javascript without an
>>>> issue. It's the syntax for plugging them into the HTML element/event that
>>>> I'm in the dark over..
>>>
>>>But so am I -- I need more information. "Plugging in" is very vague,
>>>and "the HTML element/event" even more so. Back up a bit: what are you
>>>trying to do?
>>
>> I have three range elements. Two are independent and known values, the
>> third requires the two knowns (the onchange event, above). I'm trying to
>> dynamically show (output to a span) the changed value of the third range
>> element.
>
>Right so far your code does that.
>
>> I've tried triggering an external function with the onchange event, but it
>> doesn't immediately update the desired output.
>>
>> I'm seeking the javascript syntax or method that will allow me to address
>> the parameters of the onchange event, e.g.,
>>
>> var1 = document.getElementById('var1_box').value;
>> var2 = document.getElementById('var2_box').value;
>>
>> How to dynamically assign var1 and var2 to the onchange event?
>
>Getting there. Some more actual code would help. The trouble is you
>don't have the words to describe what you need so you keep saying things
>that don't really help.
>
>You have, it seems, two input elements called 'var1_box' and
>'var2_box'. Would it be correct to say that when either of these
>changes, you want the contents of base_box to change just as if the
>range control had changed?
No. User enters var1 and var2 into the text boxes. When user changes the
value of the range element, it's value, which is dependent on var1 and
var2, is immediately displayed in 'base_box.'
>
>Note I am talking about what should happen, not how.
My problem, exactly. :-)
>Please describe
>what you need in in those terms. If you guess, and think that you need
>to "dynamically assign var1 and var2 to the onchange event" you will
>just baffle people. That phrase has no meaning to me.
I apologize for not being able to succinctly articulate what I'm trying to
do.
At any rate...I solved the issue, although I'm not so sure it's the most
elegant way to accomplish what I am seeking.
I removed all of the onchange event parameters, but kept onchange = ''.,
i.e., the HTML is now:
<input id="threshold" type="range" min=0 max=255 step=1 value="0"
onmouseUp="change_values('thr');"
onchange=""
>
I added the following to my 'external' javascript:
var1 = document.getElementById('var1_box').value;
var2 = document.getElementById('var2_box').value;
document.getElementById('threshold').setAttribute("onchange","document.getElementById('base_box').innerHTML
= (var1+ this.value*(var2 - var1)/255).toFixed(1);"
It works...
--
Ed Jay (remove 'M' to respond by email)
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.javascript
csiph-web