只是想知道如何使用JavaScript来生成输入文本而不是页面内容?

只是想知道如何使用JavaScript来生成输入文本而不是页面内容?,javascript,html,Javascript,Html,例如,我想在input4上设置值,而不是h3上的原始文本“This is header 3”。是否还有其他方法可以用javaScript实现 <html> <body> <h1 name="practice"> This is header 1 </h1> <p name="practice"> This content is contained inside paragraph one.

例如,我想在input4上设置值,而不是h3上的原始文本“This is header 3”。是否还有其他方法可以用javaScript实现

    <html>
    <body>       
    <h1 name="practice"> This is header 1 </h1>
    <p name="practice"> This content is contained inside paragraph one. Again, this is the first paragraph. </p>
        <h3 name="practice"> This is header 3 </h3>
        <p id="paragraph"> This content is contained inside paragraph three. Again, this is the third paragraph.</p>
        <h4 name="practice"> This is header 4 </h4>
        <p name="practice">This content is contained inside paragraph four. Again, this is the fourth paragraph.</p>
        </section>

        <form name ="myform" id="form">
        <fieldset>            
        <label>Name</label><input type="text" name="input3" class="input1" id="input3" value=""/>
        <label>Name</label><input type="text" name="input4" class="input1" id="input4" value="This is header 4"/>
        <label>Name</label><input type="text" name="input5" class="input1" id="input5" placeholder="testing text"/>
        </fieldset>
<input type="submit" name="submit" onclick=""/>
    <body>
    </html>

这是标题1

此内容包含在第一段中。这也是第一段

这是标题3

此内容包含在第三段中。这是第三段

这是标题4

该内容包含在第四段中。这是第四段

名称 名称 名称
什么是标记部分?反正你可以用

document.findElementById('something').innerHtml = document.getElementById('input_id').value

无法理解您的问题和您的问题…请告诉我们更多…您需要澄清您的问题。。。。太令人困惑了!很高兴看到一个不包含jQuery的响应:)好的,那么最简单的方法就是为该元素提供一个id,您将使用它
findElementById
。或者您可以构建一个
findElementByType
等的链,但这太糟糕了。此赋值应该在某个操作调用的某个函数中完成(例如,某个按钮元素上的
onclick='yourfunction()'
property)