如何使用javascript使文本框中的文本变为粗体移动焦点在它上面? [英] How to make a text in textbox bold using javascript When Moving Focus On It?

查看:56
本文介绍了如何使用javascript使文本框中的文本变为粗体移动焦点在它上面?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hi
当使用javascript将标签从它移动到下一个文本框时,如何使文本框中的文本变为粗体?



i有一个文本框如下所示/>


< input type =   text name =   useremail value =   Email ... size =   20 
onfocus = alert(this.value.fontsize(6 )) $ b $bönblur= this.style.background ='red'; this。 style.font-weight ='bold'
/>
< input type = text name = useremail value = 电子邮件... size = 20
onfocus = this.style.background ='#0b385f' $ b $bönblur= this.style.background ='#1a527d' />

< input type = text name = useremail value = 电子邮件... size = 20
onfocus = this.style.background ='#0b385f' $ b $bönblur= this.style.background ='#1a527d' />

< input type = text name = useremail value = 电子邮件... size = 20
onfocus = this.style.background ='#0b385f' $ b $bönblur= this.style.background ='#1a527d' />





i想要从文本框移动焦点时将这些文本框文本设为粗体。



谢谢..

解决方案

当你想改变css属性时你不能使用破折号( - )使用cammel案例:



this.style.font-weight - > this.style.fontWeight

Hi How to make a text in textbox bold when moving tab from it to next textbox using javascript?

i have a textbox as below

<input type="text" name="useremail" value="Email..." size="20"
onfocus="alert(this.value.fontsize(6) )"
 önblur="this.style.background  =  'red';this.style.font-weight='bold'"
 />
<input type="text" name="useremail" value="Email..." size="20"
onfocus="this.style.background  = '#0b385f'"
 önblur="this.style.background  =  '#1a527d'" />

<input type="text" name="useremail" value="Email..." size="20"
onfocus="this.style.background  = '#0b385f'"
 önblur="this.style.background  =  '#1a527d'" />

<input type="text" name="useremail" value="Email..." size="20"
onfocus="this.style.background  = '#0b385f'"
 önblur="this.style.background  =  '#1a527d'" />



i want to make these textbox text to bold when moving focus from textbox.

Thanks..

解决方案

when you want to change css properties you cannot use dash(-) use cammel case:

this.style.font-weight -> this.style.fontWeight


这篇关于如何使用javascript使文本框中的文本变为粗体移动焦点在它上面?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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