2016-03-09 13 views
0

我是IOS新手,我想添加兩個按鈕到下面的iFrame。然後點擊這些按鈕。任何幫助將不勝感激。JS中的IOS的iframe

   var iframe = document.createElement("IFRAME"); 
       iframe.setAttribute("src", 'data:text/plain,'); 
       document.documentElement.appendChild(iframe); 
       window.frames[0].window.alert('Please select the area multiplier'); 
       iframe.parentNode.removeChild(iframe); 

如果有任何其他方式作出的iframe或如果我能在向下的iFrame添加下拉,並得到了下降的所選項目下來。請讓我知道

回答

0

好吧,我已經使用了一系列的div

var mainCan=document.getElementById("cont"); 
var mainCategoryDiv; 
mainCategoryDiv && mainCategoryDiv.parentNode.removeChild(mainCategoryDiv); 
mainCategoryDiv = document.createElement("div"); 
mainVarS(mainCategoryDiv, "position", "absolute", "left", "0px", "top", "0px", "width", 645 + "px", "height", 700 + "px", "backgroundColor", "rgba(32,32,97,0.6)"); 
mainCan.parentNode.appendChild(mainCategoryDiv); 
0

說到定位,一般的ui小部件看看Bootstrap
W3有一個關於bootstrap的精彩教程部分,你會驚訝現在出來的盒子是什麼。

爲什麼使用iframe?

,可以簡化您的代碼下面有幾個小技巧:如果你使用jQuery

var iframe = document.createElement("IFRAME"); 
      iframe.setAttribute("src", 'data:text/plain,'); 
      document.documentElement.appendChild(iframe); 

,你可以:

var iframe = $('<iframe src="data:text/plain,"></iframe>'); 
$(document).appendChild(iframe); 
iframe.contentWindow.targetFunction().alert('please select the area multiplier'); 
+0

Rhys Bradbury感謝您的回覆隊友,但上面的代碼不適合我。 – gurmandeep

+0

也檢查了這個問題(http:// stackoverfl ow.com/questions/251420/invoking-javascript-code-in-an-iframe-from-the-parent-page) –

+0

仍然沒有解決方案隊友:( – gurmandeep