如何從文本框中刪除此間距。 PS:我已經檢查並確信我的變量不包含任何開頭的空格。HTML文本框中的間距
在firstpage.php,我改變了PHP變量 '$ pcodevar' 到JavaScript變量 'P碼',並把它傳遞給upload.php的。
function upload() {
var pcode=" <?php echo $pcodevar;?>";
var uploadwindow = window.open("upload.php", "_blank", "toolbar=yes,scrollbars=yes,resizable=yes,top=500,left=500,width=400,height=400");
uploadwindow.pcode= pcode;}
在upload.php,我寫了一個腳本來接收變量並將其識別爲fid_17。
<script language="javascript" type="text/javascript">
function initInput()
{
document.forms[0].fid_17.value = pcode;
}
</script>
下一頁仍處於upload.php的,
<body onLoad="initInput()">
<form name="form1" method="post" action="upload.php" enctype="multipart/form-data"/>
Project ID:
<input name="fid_17" id="fid_17" value=""/><br><br>
Upload File:
<input type="text" name="t" placeholder="File name" />
<input class="button blue" type="submit" name="upload" value="Upload/View!"/><br>
<input type="file" name="f" /><br>
</form>
謝謝你的幫助!
也許你需要'= pcode.trim()'?或'document.forms [0] .fid_17.value = opener && opener.pcode?opener.pcode.trim():「」;'' – mplungjan