简体   繁体   中英

javascript and greasemonkey question

i wanna get a price inside a page and then multiple it by 0.93 then write the result after first price. but i couldn't be able to grab the price from page.

for example i want to grap "900 TL" string from " " ”中获取“ ”字符串

you can see all codes of page by visiting http://www.sahibinden.com/cok_temiz_asus_f3jp_t7200_2ghz_2gb_ram_256_mb_harici_ekran_ka-49WQQaXQQ17829315WQQpXQQdisplayitem

thx a lot.

edit: the "f16 bold" string counts only 1 on that page. so maybe we can get "900 TL" with this..

Try this:

document.getElementsByClassName('f16 bold')[0].textContent = document.getElementsByClassName('f16 bold')[0].textContent + ' (' + parseInt(document.getElementsByClassName('f16 bold')[0].textContent)*0.93 + ')';

Note: getElementsByClassName has poor browser support (in Firefox, 3.0+ I believe).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM