开发人员 我在这里有隐藏和显示按钮的问题。
<!-- Create Folder button -->
<li class="nav-item">
<a href="" class="btn btn-primary btn-sm active" role="button" aria-pressed="true" onclick="document.getElementById('createFolderForm').style.display = 'block'; return false;"> <i class="far fa-folder fa-1x"></i> Create Folder</a>
<form id="createFolderForm" action="/create-folder" method="post" style="display: none; font-size: smaller;">
{{ csrf_field() }}
<BR>
<input type="hidden" name="folder" value="{{ $path }}">
<input type="text" name="name" placeholder="Folder name" required>
<input type="submit" value="Create" class="btn btn-success btn-sm">
</form>
</li>
<br><br>
<!-- Upload files button -->
<li class="nav-item">
<a href="" class="btn btn-primary btn-sm active" role="button" aria-pressed="true" onclick="document.getElementById('uploadForm').style.display = 'block'; return false;"><i class="fas fa-cloud-upload-alt"></i> Upload File</a>
<form id="uploadForm" action="/upload" method="post" style="display: none; font-size: smaller;" enctype="multipart/form-data">
{{ csrf_field() }}
<BR>
<input type="hidden" name="folder" value="{{ $path }}">
Select file to upload:<BR>
<input type="file" name="file" id="fileToUpload" required>
<BR><BR> <i class="fas fa-lock"></i>
Encrypt
<input type="checkbox" name="encrypt" value="1">
<BR><BR>
<input type="submit" value="Upload" class="btn btn-success btn-sm">
</form>
</li>
</ul>
<br><br>
我创建了一个文件夹并上传文件按钮,我希望它们处于某种导航状态。我面临的问题是,当我单击“创建文件夹”时,它将显示,但是当我单击“上传文件”按钮时,它将显示而没有从创建文件夹中隐藏信息。我试图使它们像显示和隐藏时都被单击,但没有这样做。任何帮助表示赞赏。
答案 0 :(得分:3)
点击按钮时是否将其他表单设置为display: none;
?
<!-- Create Folder button -->
<ul>
<li class="nav-item">
<a href="" class="btn btn-primary btn-sm active" role="button" aria-pressed="true" onclick="document.getElementById('createFolderForm').style.display = 'block'; document.getElementById('uploadForm').style.display = 'none'; return false;">
<i class="far fa-folder fa-1x"></i>
Create Folder
</a>
<form id="createFolderForm" action="/create-folder" method="post" style="display: none; font-size: smaller;">
{{ csrf_field() }}
<br>
<input type="hidden" name="folder" value="{{ $path }}">
<input type="text" name="name" placeholder="Folder name" required>
<input type="submit" value="Create" class="btn btn-success btn-sm">
</form>
</li>
<!-- Upload files button -->
<li class="nav-item">
<a href="" class="btn btn-primary btn-sm active" role="button" aria-pressed="true" onclick="document.getElementById('uploadForm').style.display = 'block'; document.getElementById('createFolderForm').style.display = 'none'; return false;">
<i class="fas fa-cloud-upload-alt"></i>
Upload File
</a>
<form id="uploadForm" action="/upload" method="post" style="display: none; font-size: smaller;" enctype="multipart/form-data">
{{ csrf_field() }}
<br>
<input type="hidden" name="folder" value="{{ $path }}">
Select file to upload:<br>
<input type="file" name="file" id="fileToUpload" required>
<br><br>
<i class="fas fa-lock"></i>
Encrypt
<input type="checkbox" name="encrypt" value="1">
<br><br>
<input type="submit" value="Upload" class="btn btn-success btn-sm">
</form>
</li>
</ul>