我有这个代码:
<html>
<script type="text/javascript">
function test() {
var Excel = new ActiveXObject("Excel.Application");
Excel.Workbook.Open("teste.xlsx");
}
</script>
<body>
<form name="form1">
<input type=button onClick="test();" value="Open File">
<br><br>
</form>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
所以主要的问题是我一直收到这个错误:
On line 7 , Unable to get value of property Open
URL file:///C:/users/admin/desktop/test.hta
Run Code Online (Sandbox Code Playgroud) 我无法看到每次我尝试运行它时都是我的错误当我打印出一些关键变量时我得到了什么:
打印longURL
打印和输出
&{400 Bad Request 400 HTTP/1.1 1 1 map [X-Frame-Options:[SAMEORIGIN] X-Xss-Protection:[1; mode = block]服务器:[GSE] Alternate-Protocol:[443:quic] Content-Type:[application/json; charset = UTF-8]日期:[星期四,2014年6月12日02:10:33 GMT]到期:[星期四,2014年6月12日02:10:33 GMT]缓存控制:[private,max-age = 0] X -Content-Type-Options:[nosniff]] 0xc2100fe940 -1 [chunked] false map [] 0xc2100581a0}
// c0de urlShort
package main
import (
"bytes"
"encoding/json"
"fmt"
"io/ioutil"
"log"
"net/http"
"os"
)
type apiResponse struct {
Id, Kind, LongURL string
}
func main() {
longURL := os.Args[len(os.Args)-1]
body := bytes.NewBufferString(fmt.Sprintf(
`{"longURL":"%s"}`,
longURL))
request, err := http.NewRequest(
"POST",
"https://www.googleapis.com/urlshortener/v1/url",
body)
request.Header.Add("Content-Type", "application/json")
client …Run Code Online (Sandbox Code Playgroud)