按ID更新表单字段? [英] Update form field by ID?

查看:66
本文介绍了按ID更新表单字段?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

好的,我的第一篇帖子很抱歉,如果我搞砸了。


我必须编辑一个使用一些javascript的页面并且不确定。


目前,用户点击黑白按钮。并且这在页面上以黑白显示图像,它还更新具有值BW的隐藏表单字段。


这样工作正常。


这里是代码。


<! - 这显示用户点击的按钮 - >


< div class =" effect" onClick =" enableGreyscale()">

< script language =" javascript">

greyscaleControl(''images / bandw.gif'', ''images / bandw.gif'',true);

< / script>

< span class =" editboxacttitle">< commonweb:resource resid =" EFFECTS_BANDW" />< / span>

< / div>


<! - end - >


<! - js功能 - >


功能enableGreyscale()

{

selectedproduct.att_effect =" BW";

selectedproduct.update();

draw();

}


<! - end - >


所以我现在需要做的是给用户选择一个功能边框颜色。


这不是重绘页面上的任何图像,所有发生的是用户点击颜色,我希望它更新隐藏的表单字段,其值为颜色。
/>
这是我用我有限的知识尝试过的。



<! - 这表示用户点击按钮 - >


< img src =" images / canvas_colours / images / canvas_taupe_small.gif"风格= QUOT;光标:指针" ALT ="灰褐色"命名= QUOT; taupe_small" ID = QUOT; taupe_small" onClick =" enableTaupe();">


<! - end - >


<! - - js函数 - >


函数enableTaupe()

{

selectedproduct.att_wrapcolour =" Taupe" ;;

selectedproduct.update();

draw();

}


<! - 结束 - >



这不起作用,表单字段中的值只表示值=""


任何帮助都会很棒!

Ok my first post here so sorry if i mess something up.

I have to edit a page that uses some javascript and not sure really.

At the moment a user clicks on a button saying "black and white" and this shows an image on the page in black and white, it also update a hidden form field with the value "BW".

This works fine.

here is the code for that.


<!-- this shows the user the button to click -->

<div class="effect" onClick="enableGreyscale()">
<script language="javascript">
greyscaleControl(''images/bandw.gif'',''images/bandw.gif'', true);
</script>
<span class="editboxacttitle"><commonweb:resource resid="EFFECTS_BANDW"/></span>
</div>

<!-- end-->

<!-- the js funtion -->

function enableGreyscale()
{
selectedproduct.att_effect = "BW";
selectedproduct.update();
draw();
}

<!-- end-->

So what i need to do now is give the users the functionality to choose a border colour.

This is not to redraw any image on the page, all that happens is a user clicks on a colour and i want it to update a hidden form field with the value of the colour.

This is what i tried with my limited knowledge.


<!-- this shows the user the button to click -->

<img src="images/canvas_colours/images/canvas_taupe_small.gif" style="cursor:pointer" alt="Taupe" name="taupe_small" id="taupe_small" onClick="enableTaupe();">

<!-- end -->

<!-- the js function -->

function enableTaupe()
{
selectedproduct.att_wrapcolour = "Taupe";
selectedproduct.update();
draw();
}

<!-- end -->



This doesn''t work, the value in the form field just says value=""

Any help would be great!

推荐答案


好​​的我在这里的第一篇文章很抱歉,如果我搞砸了什么。


我必须编辑一个使用一些JavaScript的页面并且不确定。


目前用户点击表示黑白的按钮。并且这在页面上以黑白显示图像,它还更新具有值BW的隐藏表单字段。


这样工作正常。


这里是代码。


<! - 这显示用户点击的按钮 - >


< div class =" effect" onClick =" enableGreyscale()">

< script language =" javascript">

greyscaleControl(''images / bandw.gif'', ''images / bandw.gif'',true);

< / script>

< span class =" editboxacttitle">< commonweb:resource resid =" EFFECTS_BANDW" />< / span>

< / div>


<! - end - >


<! - js功能 - >


功能enableGreyscale()

{

selectedproduct.att_effect =" BW";

selectedproduct.update();

draw();

}


<! - end - >


所以我现在需要做的是给用户选择一个功能边框颜色。


这不是重绘页面上的任何图像,所有发生的是用户点击颜色,我希望它更新隐藏的表单字段,其值为颜色。
/>
这是我用我有限的知识尝试过的。



<! - 这表示用户点击按钮 - >


< img src =" images / canvas_colours / images / canvas_taupe_small.gif"风格= QUOT;光标:指针" ALT ="灰褐色"命名= QUOT; taupe_small" ID = QUOT; taupe_small" onClick =" enableTaupe();">


<! - end - >


<! - - js函数 - >


函数enableTaupe()

{

selectedproduct.att_wrapcolour =" Taupe" ;;

selectedproduct.update();

draw();

}


<! - 结束 - >



这不起作用,表单字段中的值只表示值=""


任何帮助都会很棒!
Ok my first post here so sorry if i mess something up.

I have to edit a page that uses some javascript and not sure really.

At the moment a user clicks on a button saying "black and white" and this shows an image on the page in black and white, it also update a hidden form field with the value "BW".

This works fine.

here is the code for that.


<!-- this shows the user the button to click -->

<div class="effect" onClick="enableGreyscale()">
<script language="javascript">
greyscaleControl(''images/bandw.gif'',''images/bandw.gif'', true);
</script>
<span class="editboxacttitle"><commonweb:resource resid="EFFECTS_BANDW"/></span>
</div>

<!-- end-->

<!-- the js funtion -->

function enableGreyscale()
{
selectedproduct.att_effect = "BW";
selectedproduct.update();
draw();
}

<!-- end-->

So what i need to do now is give the users the functionality to choose a border colour.

This is not to redraw any image on the page, all that happens is a user clicks on a colour and i want it to update a hidden form field with the value of the colour.

This is what i tried with my limited knowledge.


<!-- this shows the user the button to click -->

<img src="images/canvas_colours/images/canvas_taupe_small.gif" style="cursor:pointer" alt="Taupe" name="taupe_small" id="taupe_small" onClick="enableTaupe();">

<!-- end -->

<!-- the js function -->

function enableTaupe()
{
selectedproduct.att_wrapcolour = "Taupe";
selectedproduct.update();
draw();
}

<!-- end -->



This doesn''t work, the value in the form field just says value=""

Any help would be great!



selectedproduct 和用JavaScript创建的对象?如果是这样,它是否有一个名为 att_wrapcolour 的属性?

Is selectedproduct and object created in JavaScript? If so, does it have a property called att_wrapcolour?


是的,它通常在末尾有一个订单号,所以它看起来像


att_wrapcolour_657657657657
Yes it is, it usually has a order number at the end so it looks like

att_wrapcolour_657657657657



是的,它通常在末尾有一个订单号,所以它看起来像


att_wrapcolour_657657657657
Yes it is, it usually has a order number at the end so it looks like

att_wrapcolour_657657657657



att_effect看起来也像att_effect_657657657657?存储的订单号在哪里,是否可用于update()函数?

Would att_effect also look like att_effect_657657657657? Where is the order number stored and is it available to the update() function?


这篇关于按ID更新表单字段?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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