如何在网络浏览器中获取数字的值并将该数字输入到标签的文本中? [英] how can i get the value of a number in my web browser and input that number into a label's text?

查看:98
本文介绍了如何在网络浏览器中获取数字的值并将该数字输入到标签的文本中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

好的,我的网页上有一个数字:id ="l1" class ="value"> 412/1200
我想要的数字是412.但是,这个数字可以更改.我想获取此数字并将其输入到标签的文本中.那有意义吗?我只是不知道如何正确地表达这个问题..谢谢.

ok, there is a number on my web page: id="l1" class="value ">412/1200
the number i want is 412. however, this number can change. i want to get this number and input it into a label''s text. does that make sense? i just dont know how to word this question properly.. thanks.

推荐答案

我相信您想要的是检索"/"之前的数字.如果是这样,请尝试在JavaScript中使用 regex .一旦获得该值,就可以使用javascript轻松将其设置为标签.
希望有帮助.
I believe what you want is to retrieve the number before "/". If it so, try using regex in javascript. Once you get the value you can easily set it to the label using javascript.
Hope that helps.


这篇关于如何在网络浏览器中获取数字的值并将该数字输入到标签的文本中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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