高分请教HTC(IE5.0版)中的属性重载?虎虎虎~

abent 2001-10-22 09:33:46
页面中:
<html>
<head><title>包含页面</title></head>
<body>
<input type="text" id="ddd" style="behavior:url(value.htc)">
<button onclick="alert(ddd.value)">GetValue</button>
<button onclick="ddd.value='111'">PutValue</button>
</body>
</html>

HTC中:
<public:component name="ValueReLoad">
<public:property name="value" put="putValue" get="getValue"/>
<script language="javascript">
var sValue
function putValue(argValue) {
sValue = argValue;
}

function getValue() {
return sValue + "Len";
}
</script>
</public:component>
我这样做的目的是为了让用户的输入或者通过脚本赋值到input中的值被自动的格式化,等到提交时直接提交被处理过后的值。而目前如果按下PutValue,则组件中的value元素被赋值,而ddd中并没有填写"111",我怎样才能让ddd中呈现"111"呢?
...全文
118 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
abent 2001-10-24
  • 打赏
  • 举报
回复
好了,收帖子了!谢谢无为
karma 2001-10-23
  • 打赏
  • 举报
回复
I do not think you can overload an existing property
karma 2001-10-23
  • 打赏
  • 举报
回复
if you reuse a property like "value", how do you access the old property "value"?
abent 2001-10-23
  • 打赏
  • 举报
回复
不懂,什么意思呀?
karma 2001-10-22
  • 打赏
  • 举报
回复
I do not think you can overloading an existing property
abent 2001-10-22
  • 打赏
  • 举报
回复
难道没有从DOM结构方面取得Value的方法吗?我用debugger;中断后查看ddd,发现value那一栏中还是用户输入的值,是不是说明可以用什么方法取得这个值和对这个值赋值呢?因为我更想使用一个input在主页面中而不是用一个IE:\...。
abent 2001-10-22
  • 打赏
  • 举报
回复
无为,我发现你很有点酷耶!
karma 2001-10-22
  • 打赏
  • 举报
回复
try
1.
<html xmlns:IE>
<head><title>1231</title>
<style type="text/css">
@media all {
IE\:ValueTag {
behavior:url(value.htc);
}
}
</style>
</head>
<body>

<IE:ValueTag id="ddd" value="12345"></IE:ValueTag>
<button onclick="alert(ddd.value)">GetValue</button>
<button onclick="ddd.value='111'">PutValue</button>
</body>
</html>

2. value.htc:
<public:component>
<public:property name="value" put="putValue" get="getValue"/>

<script language="javascript">
element.innerHTML = "<input type='text' id='xxx'>";
var sValue;
function putValue(argValue) {
sValue = argValue;
window.document.getElementById('xxx').value = sValue;
}

function getValue() {
sValue = window.document.getElementById('xxx').value;
return sValue + "Len";
}
</script>
</public:component>
liuswin 2001-10-22
  • 打赏
  • 举报
回复
本身input就有value属性,可能是你再定义一个value有冲突,不过我没有试,你可以换个属性名字试一试。

87,992

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧