Нужно скрипт переписать в с#
2 USDНужно этот скрипт переписать в c#
document.getElementById('lol').onclick = f1;
function f2(){
for (let li of document.querySelectorAll('li'))
li.remove();
for (let img of document.querySelectorAll('img'))
img.remove();
for (let input of document.querySelectorAll('input'))
input.remove();
for (let button of document.querySelectorAll('button'))
button.remove();
for (let h3 of document.querySelectorAll('h3'))
h3.remove();
for (let h4 of document.querySelectorAll('h4'))
h4.remove();
for (let textarea of document.querySelectorAll('textarea'))
textarea.remove();
for (let span of document.querySelectorAll('span'))
span.remove();
for (let form of document.querySelectorAll('form'))
form.remove();
for (let footer of document.querySelectorAll('footer'))
footer.remove();
for (let header of document.querySelectorAll('header'))
header.remove();
for (let center of document.querySelectorAll('center'))
center.remove();
for (let page of document.querySelectorAll('page'))
page.remove();
for (let a of document.querySelectorAll('a'))
a.remove();
}
f5();
function f1(){
f2();
const newDiv = document.createElement('div');
for (let h1 of document.querySelectorAll('h1'))
newDiv.appendChild(h1);
for (let h2 of document.querySelectorAll('h2'))
newDiv.appendChild(h2);
for (let h3 of document.querySelectorAll('h3'))
newDiv.appendChild(h3);
for (let h4 of document.querySelectorAll('h4'))
newDiv.appendChild(h4);
for (let h5 of document.querySelectorAll('h5'))
newDiv.appendChild(h5);
for (let h6 of document.querySelectorAll('h6'))
newDiv.appendChild(h6);
for (let li of document.querySelectorAll('li'))
newDiv.appendChild(li);
for (let p of document.querySelectorAll('p'))
newDiv.appendChild(p);
for (let span of document.querySelectorAll('span'))
newDiv.appendChild(span);
document.body.appendChild(newDiv);
var k = document.getElementsByTagName('section'); //удаляем див из html
var j = k[0];
document.body.removeChild(j);
document.write(document.body.innerHTML); // читаем текущее содержимое
document.body.innerHTML = c; // заменяем содержимое
}
-
204 7 0 Добрый день, хочу уточнить некоторые детали по заданию, пишите в л.с.
- Напишите в личку - обсудим детали
-

Аналог
for (let li of document.querySelectorAll('li'))
li.remove();
на C#
foreach (HtmlElement li in webBrowser1.Document.GetElementsByTagName("li"))
{
// тут что-то делаем с элементами li
}
И у вас в каждом цикле используется РАЗНАЯ переменная (li, img, input и т.д.)
Это нецелесообразно.
Можно использовать ОДНУ переменную, например elem.
-
Current freelance projects in the category C#
A small game for Unity 2DThe technical specifications are here, the scene, UI, and graphics are already available, only programming is needed https://www.figma.com/design/btykPl7Odr8ggvwmTqO8pH/Robo-Loop?node-id=0-1&t=vlanszjRgKHH5U5m-1 C# ∙ 2 hours 45 minutes back ∙ 5 proposals |
Comparative analysis of the effectiveness of custom software (v2.2-field) and reference software (Meshtastic v2.x)
22 USD
Comparative analysis of the effectiveness of custom software (v2.2-field) and reference software (Meshtastic v2.x) on the identical hardware platform (ESP32 + SX1268, 2W) based on the criteria of range, throughput, link stability, and power consumption. Conduct tests with… C & C++, C# ∙ 4 days 4 hours back ∙ 2 proposals |
Creation of a plugin for integration with the POS system Syrve, C#Develop a plugin for the Syrve POS system (on-premise), which is installed on the establishment's server. The plugin must: (1) transmit data to our server in real-time — orders, table statuses, payments, receipts; (2) receive commands from Reservble — booking confirmations,… C#, Web Programming ∙ 7 days 1 hour back ∙ 14 proposals |