输入类型中的函数=php中的文件
如何在php.Html代码中使用输入类型中的函数=php中的文件,php,html,mysql,css,Php,Html,Mysql,Css,如何在php.Html代码中使用input type=file编写函数,而不使用echo语句t与将路径复制到textbox一样有效 <form name="profile" method="post" enctype="multipart/form-data"> <?php echo '<p style="margin-left:1cm"><input type="text" id="file2" size=18 maxlength=500
input type=file
编写函数,而不使用echo语句
t与将路径复制到textbox一样有效
<form name="profile" method="post" enctype="multipart/form-data">
<?php
echo '<p style="margin-left:1cm"><input type="text" id="file2" size=18 maxlength=500><input type="file" name="bfile2" onchange="CopyMe(this, 'file2');" /></p>';
?>
</form>
<script>
function CopyMe(oFileInput, sTargetID) {
document.getElementById(sTargetID).value = oFileInput.value;
}
您的问题在于此部分:
CopyMe(this, 'file2');
”
字符正在打断您的回音。
使用\
对字符进行转义
因此,您的代码最终为:
echo '<p style="margin-left:1cm"><input type="text" id="file2" size=18 maxlength=500><input type="file" name="bfile2" onchange="CopyMe(this, \'file2\');" /></p>';
echo';
谢谢。它正在工作