2014-01-23 69 views
0

我已經創建了一個本地站點,用於我在rails中進行的一個側面項目。如何創建一個嵌入到網站的iframe按鈕

我正在創建一個網站,基本上打開一個模式彈出並顯示一些關於該網站當前的數據。所以網站的標題和元描述就是這樣。

我想知道創建一個iframe是多麼容易,這是我的網站上面,但我可以把另一個測試網站,我已經設置了測試一些功能?

我在rails中使用機械化來獲取數據,這很容易,但我想知道如何人們在網站上創建一個嵌入式按鈕?

源 'https://rubygems.org'

# Bundle edge Rails instead: gem 'rails', github: 'rails/rails' 
gem 'rails', '4.0.0' 

# Use sqlite3 as the database for Active Record 
gem 'sqlite3' 

# Use SCSS for stylesheets 
gem 'sass-rails', '~> 4.0.0' 

# Use Uglifier as compressor for JavaScript assets 
gem 'uglifier', '>= 1.3.0' 

# Use CoffeeScript for .js.coffee assets and views 
gem 'coffee-rails', '~> 4.0.0' 

# See https://github.com/sstephenson/execjs#readme for more supported runtimes 
# gem 'therubyracer', platforms: :ruby 

# Use jquery as the JavaScript library 
gem 'jquery-rails' 

# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks 
gem 'turbolinks' 

# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder 
gem 'jbuilder', '~> 1.2' 

# Lets start my custom gem pile here: 

gem 'mechanize', '2.7.2' 

group :doc do 
    # bundle exec rake doc:rails generates the API under doc/api. 
    gem 'sdoc', require: false 
end 

回答

0

寫入按鈕點擊此代碼爲創建的iframe

$('#button').click(function() { 
if($('#myIframe').size() == 0) { 
    $('<iframe id="myIframe" src="http://stackoverflow.com"></iframe>'); 
} 

});

相關問題