firefox的onpropertychange [英] onpropertychange for firefox

查看:91
本文介绍了firefox的onpropertychange的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,


我为IE编写了一段使用onpropertychange的代码。我想让代码也能在Firefox上运行,但我找不到在JS脚本中更改值时触发的等效事件,我需要帮助。


我的问题是这个。我有2个html元素:隐藏的输入类型保留将要发布的值和显示用户值的UI值(type = text)。我需要做的是同步这两个值的修改:当隐藏元素被更改时,UI值被更改,反之亦然。


我的IE脚本: br />

Hello,

I have a piece of code written for IE that uses onpropertychange. I want to make the code work on Firefox also, but i couldnt find an equivalent event that fires when the value is changed in JS scripts and i need help.

My problem is this. I have 2 html elements: an input type hidden that keeps the value which will be posted and an UI value (type=text) that shows the value to the user. What I need to do is to syncronize the modifications for these two values: when the hidden element is changed, the UI value is changed and vice-versa.

My script for IE :

展开 | 选择 | Wrap | 行号

推荐答案

请注意,没有JScript这样的东西。在标准HTML中。将其更改为< script type =" text / javascript">
please note that there is no such thing as "JScript" in standard HTML. Change this to <script type="text/javascript">


onpropertychange仅限IE。请改用onchange。这可能不完全相同,所以你必须在你的代码中容纳它。
onpropertychange is IE-only. Use onchange instead. This may not do exactly the same thing though, so you''ll have to accommodate that in your code.



onpropertychange是IE-只要。请改用onchange。这可能不完全相同,所以你必须在代码中容纳它。
onpropertychange is IE-only. Use onchange instead. This may not do exactly the same thing though, so you''ll have to accommodate that in your code.



我知道onpropertychange只是IE浏览器(我在IE .htc文件中使用了行为处理程序)。我想知道的是,当一个属性的值从一个javascript函数中改变时(例如我更改了隐藏的值,事件被触发),我必须向我的元素注册什么事件才能执行我的函数并执行我的同步功能)。当我从JS函数更改隐藏的值时,Onchange不会触发。

I know about onpropertychange being IE-only (I used behaviour handlers in IE .htc files). What I want to know is what event for mozilla must i register with my elements in order to execute my functions when the value of a property is changed from within a javascript function (for example I change the value of the hidden, the event gets fired and executes my syncronization functions). Onchange doesnt fire when i change the value of the hidden from a JS function.


这篇关于firefox的onpropertychange的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆