1. 程式人生 > >iframe獲取焦點的問題、獲取iframe src、開啟新視窗window.open()

iframe獲取焦點的問題、獲取iframe src、開啟新視窗window.open()

<iframe id="embed"  frameborder="no"  name="abc" border="0"  src="www.lingpic.com"  style="width:100%; color:#000;" mozallowfullscreen webkitallowfullscreen allowfullscreen></iframe>

1、先獲取iframe再加focus()函式

document.getElementById('embed').focus();

2、在iframe框架裡面點選元素讓iframe獲取焦點

如果www.lingpic.com裡面有個<div id="box"></div> 的元素 那我們點選box讓iframe獲取焦點。例:

document.getElementById('box').onclick = function(){

       var aFrame = parent.frames;      //獲取frames 是個類似陣列

       aFrame[0].focus();

}

3、在iframe裡獲取iframe的src

document.getElementById('box').onclick = function(){

       var aFrame = parent.frames;      //獲取frames 是個類似陣列

      var src = aFrame[0].location.href;

      //開啟新視窗

      window.open (src, 'newwindow', 'height=700, width=1000, top=50,left=100, toolbar=no, menubar=no, scrollbars=no, resizable=no,location=no, status=no')

}

開啟新視窗 newwindow名稱只有不同的時候才能開啟多個新視窗


相關推薦

iframe獲取焦點的問題獲取iframe src開啟視窗window.open()

<iframe id="embed"  frameborder="no"  name="abc" border="0"  src="www.lingpic.com"  style="width:100%; color:#000;" mozallowfullscreen

幾個主流瀏覽器 Window.open開啟視窗 模擬a標籤開啟視窗的 表現

Window.open開啟新視窗 1、常用瀏覽器開啟新視窗(正常開啟window.open)的的不同表現形式(PC/移動端) 2、Window.open在非同步處理中開啟(_blank) a標籤在非同步處理中開啟 -公眾號跳轉的微信瀏覽器都是單視窗多頁面開啟,沒有tab頁,詳情頁返回都會重新

Vue--由自動獲取焦點引出的DOMmounted自定義指令

order spl type bottom fcc auto 表達式 hit 默認 一.自動獲取焦點的DOM實現 1 <!DOCTYPE html> 2 <html lang="en"> 3 4 <head>

去掉谷歌瀏覽器獲取焦點時默認的inputtextarea的邊框和背景

鼠標 area 大小 要去 HA change 元素 lin chrom 去掉chrome(谷歌)瀏覽器默認的input、textarea的邊框(border)和背景(background) 及chrome下不可更改textarea大小 1、使用Chrome的都知道,當鼠標

初學QT筆記: 多個QLineEdit之間的焦點設定切換獲取

學習實現計算器中,點選一個lineEdit後,再點選數字按鈕,可以將資料或符號顯示在選定的lineEdit中。 booleventFilter(QObject*,QEvent*); MainWindow::MainWindow(QWidget*parent): QMa

spandivli 等獲取焦點問題

對於普通的div/span/li等元素節點是不能直接獲取焦點的,需要用到一個屬性tabindex 2、關於tabindex的科普 如果試圖觸發div標籤繫結的onfocus事件和onblur事件,需要為該標籤新增tabindex屬性。 tabindex屬性

input輸入框獲取焦點獲取焦點位置焦點設定

使用按鈕進行文字資訊的修改和刪除,並從游標指定位置修改文字內容,不使用鍵盤的退格鍵。 <!doctype html> <html lang="en">  <head>   <meta charset="UTF-8">   &l

table中td元素,不可操作不可編輯獲取不到焦點不能被選中

在要讓文字不能被選中的TD內加入onselectstart="return false" onselect="document.selection.empty()"<table><t

c#中如何獲取本機MAC地址IP地址硬盤IDCPU序列號等系統信息

finall ipaddress reac 地址 computer mod urn aca rop public class Computer { public static string CpuID; //1.cpu序列號 pub

Cookie的存儲獲取刪除操作

.get expires get string -1 urn pre var win var Cookie={ set: function (name, value, days) { var d = new Date; d.se

Java-小技巧-004-獲取當前時間前一周前一月前一年的時間

當前 println cal simple 時間 過去 sta logs settime SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); Calendar c

js獲取窗口滾動條高度窗口可視範圍高度文檔實際內容高度滾動條離瀏覽器底部的高度

onscroll style pre span 文檔 log ner ons cti 1.獲取窗口可視範圍的高度 1 //獲取窗口可視範圍的高度 2 function getClientHeight(){ 3 var clientHeight=0;

IT小鮮肉 Widgets Tree 單選多選相關回調函數獲取選中的節點功能

-128 key log 中斷 images 結束 type 小時 調用 寫一個樹控件並沒有想象中的那麽容易,今天又花了我一個1個多小時,主要為IT小鮮肉 Widgets Tree控件添加了 單選、多選、選擇前和選擇後兩個回調函數、獲取選中節點的功能。後面會繼續努力完善這個

【Appnium+C#+Winform自動化測試系列】一獲取本機連接的設備啟動多個Appnium和獲取本機啟動的Appnium

net 系列 () 定向 目的 res listening toa 路徑     本系列內容,準備根據所完成的項目為基線,一步一步的把整個設計和實現過程梳理。 先從基本的一些環境問題入手,梳理清楚關於手機設備和Appnium。因為我們在後面的建立Appnium連接時,需要

vue如何配置路由 獲取路由的參數部分刷頁面緩存頁面

component 有一個 數據 main -a his 如何配置 自動 收件人 1、路由配置:所有的啟動文件都在最初始的main.js文件裏面,這個文件中首先需要引入: 2、路由文件配置說明: 3、如何獲取頁面url的參數? this.$route.quer

cookie——創建獲取刪除

subst get head split mail 結束 tar string .com <!DOCTYPE html> <html> <head> <meta charset="UTF-8">

Android開發:SharedPreferences 存儲數據獲取數據

.get 本地 www phone win7 popu ces androi studio Android開發:SharedPreferences 存儲數據、獲取數據 email:[email protected]/* */ 開發環境:w

獲取當前周上一周下一周的日期

date get orm nth table itl form ble .get 使用JS或者是JQuery獲取當前周和上一周、下一周的日期時間信息的方法,摘自 http://www.qdfuns.com/notes/18184/435de54dd1e41baf677703

Js/Jquery獲取iframe中的元素 在Iframe獲取父窗體的元素方法

window mob 父窗口 tno .get nbsp ren 中控 get 在父窗口中獲取iframe中的元素 1、 格式:window.frames["iframe的name值"].document.getElementByIdx_x("iframe中控件的ID

操作手機wifi(打開關閉獲取連接信息)

ret activit style onclick and manage bundle tar pad 頁面布局: <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"