小编MC_*_*a_T的帖子

IE10在页面上找到第一个按钮,并在输入提交时触发点击事件

抱歉标题,我知道它凌乱,但我不知道我怎么能描述这种情况.

我们有一个输入字段.但没有形式元素.这是代码

<input name="search" id="search" onkeypress="SearchBox(this.value);" type="text" value="Search"/>
<input name="searchbutton" align="left" class="okbutton" id="searchbutton" onclick="SearchBox(search.value);" type="button"/>
Run Code Online (Sandbox Code Playgroud)

SearchBox函数检查keycode,如果是13(输入按钮charcode)发送搜索请求.此代码适用于IE8/9,但在IE10中有一些有趣的行为.

上面的代码页面中间.我们在LOGIN的页面顶部有一个按钮元素.

在IE10中;

我在输入中输入一个单词并按回车键:

  • SearchBox功能工作,
  • 但是表现得像LOGIN按钮一样也是一个问题

注意:抱歉语言,英语不是我的母语.注2:删除了SearchBox()函数.检查jsfiddle链接以获取最新代码.

javascript forms submit internet-explorer-10

8
推荐指数
1
解决办法
4983
查看次数

如何从Internet Explorer中的剪贴板获取base64编码图像?

我搜索了很多但没有找到从剪贴板获取base64编码数据.我可以捕获粘贴事件,然后将事件分配给变量

clipBoard = e.clipboardData ? e.clipboardData : window.clipboardData;
Run Code Online (Sandbox Code Playgroud)

在铬; 我可以得到已粘贴的打印屏幕,就像这样

if (clipBoard.types[0] == "Files") {
    var blob = clipBoard.items[0].getAsFile();

    var reader = new FileReader();
    reader.onload = function(event){
    console.log(event.target.result);
    }; // data url!
    reader.readAsDataURL(blob);
}
Run Code Online (Sandbox Code Playgroud)

但是在11中,clipBoard变量没有"items"或"types".我将上传该图像服务器,但我没有得到base64编码数据.

javascript clipboard internet-explorer-11

5
推荐指数
1
解决办法
7711
查看次数

如何使用 google drive api v3 列出根目录中的文件/目录?

我正在做一个网站项目。我在 Google Developers Console 上创建了一个应用程序,并在我的服务器上安装了 Google SDK。授权完成,离线访问完成,列出所有文件/目录完成,创建文件完成。

现在我想列出位于根目录中的文件/目录。我的意思是只有那些不是所有的子目录。

这是代码示例:

    // $client is a Google_Client object
    $service = new Google_Service_Drive($client);
    // Print the names and IDs for up to 10 files.
    $optParams = array(
        'pageSize' => 10,
        'fields' => "nextPageToken, files(contentHints/thumbnail,fileExtension,iconLink,id,name,size,thumbnailLink,webContentLink,webViewLink,mimeType,parents)",
        'q' => "trashed=false"
    );
    $results = $service->files->listFiles($optParams);

    if (count($results->getFiles()) == 0) {
        print "No files found.\n";
    } else {

        print "Files:\n";
        foreach ($results->getFiles() as $file) {
            echo "Dosya Ad?: ".$file->getName()."<br>";
            echo "Dosya Id: ".$file->getId()."<br>";
            echo "Tip: ".$file->getMimeType()."<br>";
            echo "Dosya Link: …
Run Code Online (Sandbox Code Playgroud)

php google-drive-api

3
推荐指数
2
解决办法
2704
查看次数