加粗返回 URL
Bolding a returned URL
我正在为我们的组织开发上传门户,当人们向我们的编码提交文件时,我希望它生成的 URL 为 BOLD。我对 HTML 和编码有基本的了解,但在尝试加粗生成的 URL (+file.getURL()) 时我完全迷失了。任何帮助将不胜感激。这是我正在使用的所有编码。
form.html
<form id="myForm">
<h1>NHD Paper Upload</h1>
<label>Name</label>
<br />
<input type="text" name="myName" placeholder="Enter your full name..">
<p><label>Division</label>
<br />
<input type="text" name="myDivision" placeholder="(ex. Junior or Senior)"></p>
<p><label>School</label>
<br />
<input type="text" name="mySchool" placeholder="Enter your school.."></p>
<p><label>Affiliate</label>
<br />
<input type="text" name="myAffiliate" placeholder="Enter your affiliate.."></p>
<p><label>Select file to upload. Make sure your file is labeled in the following manner: <b>LastName_Division_School_State.pdf</b></label></p>
<input type="file" name="myFile">
<input type="submit" value="Submit File"
onclick="this.value='Please be patient while your paper is uploading..';
google.script.run.withSuccessHandler(fileUploaded)
.uploadFiles(this.parentNode);
return false;">
<p>
<label><b>Once upload is successful please stay on this window to copy and paste the URL produced on the next screen into registration.</b></label>
<br />
<label><b>If you have any issues or questions please send an email to <a href="mailto:elaine@nhd.org">elaine@nhd.org</a>.</b></label>
</p>
</form>
<div id="output"></div>
<script>
function fileUploaded(status) {
document.getElementById('myForm').style.display = 'none';
document.getElementById('output').innerHTML = status;
}
</script>
<style>
input { display:block; margin: 20px; }
</style>
server.gs
function doGet(e) {
return HtmlService.createHtmlOutputFromFile('form.html');
}
function uploadFiles(form) {
try {
var dropbox = "NHD Papers";
var folder, folders = DriveApp.getFoldersByName(dropbox);
if (folders.hasNext()) {
folder = folders.next();
} else {
folder = DriveApp.createFolder(dropbox);
}
var blob = form.myFile;
var file = folder.createFile(blob);
file.setDescription("Uploaded by " + form.myName + ", Division: " + form.myDivision + ", School: " + form.mySchool + ", State: " + form.myState);
return "File uploaded successfully! Copy and paste the following URL into registration: " + file.getUrl();
} catch (error) {
return error.toString();
}
}
如有任何帮助,我们将不胜感激。我正在 Google 脚本中处理此问题。
您有没有使用 b 标签的原因?像这样:
"<b>" + file.getUrl() + "</b>";
我正在为我们的组织开发上传门户,当人们向我们的编码提交文件时,我希望它生成的 URL 为 BOLD。我对 HTML 和编码有基本的了解,但在尝试加粗生成的 URL (+file.getURL()) 时我完全迷失了。任何帮助将不胜感激。这是我正在使用的所有编码。
form.html
<form id="myForm">
<h1>NHD Paper Upload</h1>
<label>Name</label>
<br />
<input type="text" name="myName" placeholder="Enter your full name..">
<p><label>Division</label>
<br />
<input type="text" name="myDivision" placeholder="(ex. Junior or Senior)"></p>
<p><label>School</label>
<br />
<input type="text" name="mySchool" placeholder="Enter your school.."></p>
<p><label>Affiliate</label>
<br />
<input type="text" name="myAffiliate" placeholder="Enter your affiliate.."></p>
<p><label>Select file to upload. Make sure your file is labeled in the following manner: <b>LastName_Division_School_State.pdf</b></label></p>
<input type="file" name="myFile">
<input type="submit" value="Submit File"
onclick="this.value='Please be patient while your paper is uploading..';
google.script.run.withSuccessHandler(fileUploaded)
.uploadFiles(this.parentNode);
return false;">
<p>
<label><b>Once upload is successful please stay on this window to copy and paste the URL produced on the next screen into registration.</b></label>
<br />
<label><b>If you have any issues or questions please send an email to <a href="mailto:elaine@nhd.org">elaine@nhd.org</a>.</b></label>
</p>
</form>
<div id="output"></div>
<script>
function fileUploaded(status) {
document.getElementById('myForm').style.display = 'none';
document.getElementById('output').innerHTML = status;
}
</script>
<style>
input { display:block; margin: 20px; }
</style>
server.gs
function doGet(e) {
return HtmlService.createHtmlOutputFromFile('form.html');
}
function uploadFiles(form) {
try {
var dropbox = "NHD Papers";
var folder, folders = DriveApp.getFoldersByName(dropbox);
if (folders.hasNext()) {
folder = folders.next();
} else {
folder = DriveApp.createFolder(dropbox);
}
var blob = form.myFile;
var file = folder.createFile(blob);
file.setDescription("Uploaded by " + form.myName + ", Division: " + form.myDivision + ", School: " + form.mySchool + ", State: " + form.myState);
return "File uploaded successfully! Copy and paste the following URL into registration: " + file.getUrl();
} catch (error) {
return error.toString();
}
}
如有任何帮助,我们将不胜感激。我正在 Google 脚本中处理此问题。
您有没有使用 b 标签的原因?像这样:
"<b>" + file.getUrl() + "</b>";