开发者

how to populate input type tesxt with ajax

开发者 https://www.devze.com 2023-01-01 08:35 出处:网络
I want to know how can i populate a开发者_Go百科 value of input type text with ajax. Thanks.By, AJAX I assume you mean JavaScript.

I want to know how can i populate a开发者_Go百科 value of input type text with ajax.

Thanks.


By, AJAX I assume you mean JavaScript.

Well, you could use something like this:

<html>
<head>
<title>Form Example</title>

<script type="text/javascript">
window.onload = function()
{
    document.myform.mytext.value = "TEXTBOX";
}
</script>

</head>
<body>

<form name="myform" method="get">
<input type="text" name="mytext" />
</form>

</body>
</html>

Explanation:

Once the document has finished loading the script looks for the form named "myform". Then it looks for an element named "mytext" inside this form and you can then set/change the value property to what you desire.

0

精彩评论

暂无评论...
验证码 换一张
取 消