0
データテーブルに配列する必要があるスクリプト内にデータがあります。私はこれを達成するための方法がわかりません。私は、データテーブルには、このデータをバインドし、それらにとして警告のポップアップを表示するのではなく、Webページに表示したいデータをASP.NETのデータテーブルにバインドする
<script>
var $textarea = $('#TextArea1'), $submit = $('#Submit1');
$submit.click(function (e) {
e.preventDefault();
sourceCode = $textarea.val();
var $searchObject = $('<div id="Searching"></div>');
$searchObject.append($(sourceCode));
alert("Number of text boxes = " + $searchObject.find('[type=text]').length);
$searchObject.find('[type=text]').each(function() {
alert("Name of textbox = " + $(this).attr("name") + " and its ID is " + $(this).attr("id"));
});
alert("Number of Submit Buttons = " + $searchObject.find('[type=submit]').length);
$searchObject.find('[type=submit]').each(function() {
alert("Name of Submit button = " + $(this).attr("name") + " and its ID is =" + $(this).attr("id"));
});
alert("Number of Telephone entry fields = " + $searchObject.find('[type=tel]').length);
$searchObject.find('[type=tel]').each(function() {
alert("Name of Telephone entry field button = " + $(this).attr("name") + " and its ID is =" + $(this).attr("id"));
});
alert("Number of Password boxes = " + $searchObject.find('[type=password]').length);
$searchObject.find('[type=password]').each(function() {
alert("Name of Password box = " + $(this).attr("name") + " and its ID is =" + $(this).attr("id"));
});
alert("Number of check boxes = " + $searchObject.find('[type=checkbox]').length);
$searchObject.find('[type=submit]').each(function() {
alert("Name of Submit button = " + $(this).attr("name") + " and its ID is =" + $(this).attr("id"));
});
alert("Number of Radio buttons on page = " + $searchObject.find('[type=radio]').length);
$searchObject.find('[type=radio]').each(function() {
alert("Name of radio button = " + $(this).attr("name") + " and its ID is =" + $(this).attr("id"));
});
alert("Number of drop down lists = " + $searchObject.find('select').length);
$searchObject.find('[type=select]').each(function() {
alert("Name of select button = " + $(this).attr("name") + " and its ID is =" + $(this).attr("id"));
});
alert("Number of Images on page = " + $searchObject.find('img').length);
$searchObject.find('[type=img]').each(function() {
alert("Name of Image = " + $(this).attr("name") + " and its ID is =" + $(this).attr("id"));
});
alert("Number of Hyperlinks on page = " + $searchObject.find('a[href]').length);
alert("Number of Buttons = " + $searchObject.find('[type=button]').length);
$searchObject.find('[type=button]').each(function() {
alert("Name of button = " + $(this).attr("name") + " and its ID is =" + $(this).attr("id"));
});
alert("Number of Date entry fields= " + $searchObject.find('[type=date]').length);
$searchObject.find('[type=date]').each(function() {
alert("Name of date button = " + $(this).attr("name") + " and its ID is =" + $(this).attr("id"));
});
});
</script>
:中
データがあります。データは、
<table>
<tr>
<th>Element </th>
<th>Element name</th>
<th>Element ID</th>
</tr>
</table>
のテーブルの下に配置する必要があります。これを行うにはどのような方法が最適でしょうか?誰もがこれを行うコードで私を助けてもらえますか?
ありがとうございます。
あなたは何を求めているのでしょうか?スクリプトのデータからデータテーブルを作成したいのですか?もしそうなら、なぜコードをコードの中に記述してデータテーブルを作成しないのですか? –