المتطلبات والرمز هي كما يلي:
"هذا هو الكود الخاص بي:"
<type type = "text" id = "price2" value = "333" /> <input type = "text" id = "trueprice" value = "" />
<script type = "text/javaScript"> document.getElementById ("price2"). onKeyup = function () {document.getElementById (سؤال: الآن عند فتح هذه الصفحة ، تكون قيمة trueprice فارغة بشكل افتراضي. كيف يمكنك تحقيق الافتتاح الافتراضي ل trueprice هل هو نفسه Price2؟ (Price2 هو قيمة ديناميكية)
<type type = "text" id = "trueprice" value = "" /> تم إصلاحه ولا يمكن تعديله
تطبيق بسيط لي:
<! doctype html> <html> <head> <meta http-equiv = "content-type" content = "text/html ؛ charset = utf-8"> <title> اختبار </title> </head> <body> <body> type = "text" id = "price2" value = "333 id = "trueprice" value = "" /> <script type = "text /javaScript"> var price2 = document.getElementById ("price2"). value ؛ document.getElementByid ( DefaultVal ؛} </script> </body> </html>تأثير:
يمكن مزامنة المحتوى الذي تم إدخاله في مربع النص الأول إلى مربع النص الثاني