المتطلبات: انقر فوق الزر للحصول على المحتوى المحدد في مربع الإدخال ، بحيث يتحول المحتوى المحدد إلى اللون الأحمر.
التنفيذ: الرمز كما يلي
<! doctype html> <html> <head> <meta http-equiv = "content-type" content = "text/html ؛ charset = utf-8"> <title> test </title> <type> ed ide = "text/css"> div {display: none ؛ type = "button" value = "احصل على القيمة في مربع النص" id = "btn" onClick = "getText () ؛ "block" ؛ showtext.style.color = "red" ؛ showtext.innerhtml = document.getElementById ("txt"). value ؛} </script> </body> </html>تأثير: