嗨,我正在制作一个调用网络摄像头到目前为止所有工作正常的表格,但我想在我的表格表格中显示对齐网络摄像头屏幕 我希望网络摄像头输出显示在id为“cam”的div中。请有人帮帮我
这是我的javascript
<script>
document.getElementById("cam").innerHTML = document.write(webcam.get_html(320, 420));
</script>
这是我的HTML
<body bgcolor="Darkgrey">
<form name="entry" method="POST" action="" id="entry">
<table border="1" bgcolor="Silver">
<tr>
<td>
</td>
<td>
<h2><b>Candidate Entry</b><h2>
</td>
</tr>
<tr>
<td>
Code
</td>
<td>
<input type="text" name="vouchno" value="New" onkeypress="return isNumberKey(event)" readonly="readonly" size="8" maxlength="8">
Date
<input type="text" name="vouchdt" id="popupDatepicker" tabindex="1"></td>
<td>
<input type="text" name="councode" size="1" maxlength="2"><input type="text" name="counvouch" size="8" maxlength="8">
</td>
<td><div id="cam">
<input type=button value="Configure..." onClick="webcam.configure()">
<input type=button value="Take Snapshot" onClick="take_snapshot()">
<div id="upload_results" style="background-color:#eee;"></div>
</div>
</td>
</tr>
<tr>
<td>
Name
</td>
<td>
<input type="text" name="name" value="" maxlength="40" size="45" tabindex="2">
</td>
</tr>
<tr>
<td>
Address
</td>
<td>
<textarea name="add" row="3" cols="40" tabindex="3">
</textarea>
</td>
</tr>
<tr>
<td>
City
</td>
<td>
<input type="text" name="city" size="20" maxlength="20"value="" tabindex="4">
Pin
<input type="text" name="pin" size="6" maxlength="6"value="" tabindex="5">
</td>
</tr>
<tr>
<td>
Nationality
</td>
<td>
<input type="text" name="ntn" value="" size="10" maxlength="10" tabindex="6">
</td>
</tr>
<tr>
<td>
Mobile No
</td>
<td>
<input type="text" name="mob" value="" tabindex="7">
</td>
</tr>
<tr>
<td>
Date of Birth
</td>
<td>
<input type="text" name="dob" id="popupDatepicker2" tabindex="8">
</td>
<td>
Age
</td>
<td width="9px">
<input type="text" name="age" size="3" maxlength="3" value="" tabindex="9">
</td>
<td width="10px">
Sex
</td>
<td>
<select name="sex" tabindex="12">
<option value="m">Male</option>
<option value="f">Female</option>
</select>
</td>
</tr>
<tr>
<td>
Religion
</td>
<td>
<input type="text" name="rel" value="" size="20" maxlength="20" tabindex="11">
</td>
<td>
Martial Status
</td>
<td>
<select name="status" tabindex="12">
<option value="">--select--</option>
<option value="1">Married</option>
<option value="2">Unmarried</option>
</select>
</td>
</tr>
<tr>
<td>
Passport No.
</td>
<td>
<input type="text" name="pass" value="" size="15" maxlength="15" tabindex="13">
</td>
<td>
Place of Issue
</td>
<td>
<input type="text" name="poi" size="20" maxlenght-20 tabindex="14">
</td>
<td>
Date of Issue
</td>
<td>
<input type="text" name="doi" id="popupDatepicker4" tabindex="15">
</td>
</tr>
<tr>
<td>
Profession
</td>
<td>
<input type="text" name="prof" size="20" maxlenght="20" value="" tabindex="16">
</td>
<td>
Amount
</td>
<td>
<input type="text" id="amt" name="amt" value="" onblur="calculateText()" tabindex="17">
</td>
</tr>
<tr>
<td>
Payment
</td>
<td>
<input type="text" id="pay" name="pay" value="" tabindex="20" >
</td>
<td>
Received
</td>
<td>
<input type="text" id="resc" name="resc" value="" onblur="calculateText()" tabindex="18">
</td>
</tr>
<tr>
<td>
Agent
</td>
<td>
<input type="tetx" name="agnt" value="" size="40" maxlength="40" tabindex="21">
</td>
<td>
Balance
</td>
<td>
<input type="text" id="bal" name="bal" readonly="readonly" value="" onblur="calculateText()" tabindex="19">
</td>
</tr>
<tr>
<td>
Mofa No.
</td>
<td>
<input type="text" name="mofa" value="" size="20" maxlength="20" tabindex="22">
</td>
</tr>
<tr>
<td>
Remarks
</td>
<td>
<input type="text" name="rem" size="60" maxlength="60" value="" tabindex="23">
</td>
</tr>
<table border="0" align="center">
<tr>
<td>
<input type="submit" name="save" value="Save">
<td>
<input type="submit" name="print" value="Print">
</td>
<td>
<input type="submit" name="close" value="Cancel">
</td>
</tr>
</table>
</table>
</form>
</body>
</html>
答案 0 :(得分:1)
document.write
将内容写入文档,因此请更改:
document.getElementById("cam").innerHTML = document.write(webcam.get_html(320, 420));
到
document.getElementById("cam").innerHTML = webcam.get_html(320, 420);
答案 1 :(得分:0)
更改:
document.getElementById("cam").innerHTML = document.write(webcam.get_html(320, 420));
到:
document.getElementById("cam").innerHTML = webcam.get_html(320, 420);