Замена обзаца
Здравстсвуйте знатоки..
нужно и заменить обзац в html пробую прописать через js document.body.innerHTML = document.body.innerHTML.replace(/еееее ееее ееее, еееееl/g, 'кккккк ккккк. ккккккбккккк, ккккк'); но как вы сами поняли не работает...подскажите как все это грамотно реализовать? :( |
Приведите код, кусок кода HTML, где надо делать замену.
Абзац в HTML обычно делается с помощью тега <p>. Пробелы в регулярном выражении обозначаются \s |
Цитата:
<div align="left">We accept payment in the form of <strong>PayPal</strong> (preferred method). Payment must be made via eBay. Items will not ship until payment is received. We are required to collect 8.875% sales tax to all orders shipped to NY state residents. This will be added to your order upon checkout. International orders can only be made via PayPal. Please contact us via Ebay for more information. <br></div> НА We accept payment in the form of Credit or Debit card. Items will not ship until payment is received. We are required to collect sales tax to all orders. This will be added to your order upon checkout. Please contact us for more information. |
Как нибудь так попробуйте
<!DOCTYPE html> <htmll lang="ru"> <head> <title>Untitled</title> <meta charset="utf-8"> </head> <body> <div align="left">We accept payment in the form of <strong>PayPal</strong> (preferred method). Payment must be made via eBay. Items will not ship until payment is received. We are required to collect 8.875% sales tax to all orders shipped to NY state residents. This will be added to your order upon checkout. International orders can only be made via PayPal. Please contact us via Ebay for more information. <br></div> <button id=bch>Заменить</button> </body> <script> let rex =/We\saccept\spayment\sin\sthe\sform\sof\s<strong>PayPal<\/strong>(.+)Please\scontact\sus\svia\sEbay\sfor\smore\sinformation\.\s<br>/; let ss =`We accept payment in the form of Credit or Debit card.<br> Items will not ship until payment is received.<br> We are required to collect sales tax to all orders.<br> This will be added to your order upon checkout.<br> Please contact us for more information.` document.getElementById('bch').onclick = () => document.body.innerHTML = document.body.innerHTML.replace(rex, ss); </script> </html> |
Цитата:
|
Цитата:
Значит надо как то этот div искать и в нем менять. |
Благодарю Вас за вашу помошь!
скажите пожалуйста а каким образом можно изменить 2-й обзац на том же странице..? |
Часовой пояс GMT +3, время: 03:39. |