我已经用CSS和HTML创建了两个页面,现在我想将两者链接在一起。
我找到了这段代码,但是我相信还有更好的选择:
<form action="http://google.com">
<input type="submit" value="Go to Google" />
</form>
如果使用此功能,是否必须将两个页面都上传到互联网?如何将我的两个页面链接在一起?
答案 0 :(得分:0)
尝试以下代码,
<a href="http://google.com">Go to Googl</a>
答案 1 :(得分:0)
如果您想坚持使用Form方法,请参见下文:
<form action="http://www.google.com">
<button type="submit" class="">Go to Google</button>
</form>
这更优雅:
<a href="http://www.google.com/">
<input type="button" value="Go to Google" />
</a>
答案 2 :(得分:-1)
尝试此代码,它将帮助您学习HTML和Bootstrap
func writeToFile(data: Data, fileName: String){
// get path of directory
guard let directory = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask).last else {
return
}
// create file url
let fileurl = directory.appendingPathComponent("\(fileName).txt")
// if file exists then write data
if FileManager.default.fileExists(atPath: fileurl.path) {
if let fileHandle = FileHandle(forWritingAtPath: fileurl.path) {
// seekToEndOfFile, writes data at the last of file(appends not override)
fileHandle.seekToEndOfFile()
fileHandle.write(data)
fileHandle.closeFile()
}
else {
print("Can't open file to write.")
}
}
else {
// if file does not exist write data for the first time
do{
try data.write(to: fileurl, options: .atomic)
}catch {
print("Unable to write in new file.")
}
}
}