2010-01-27 34 views
0

我有這樣的功能:在同一頁面上設置多個按鈕的參數?總新手問題

<SCRIPT language="JavaScript"> 
<!-- 
function go_there() 
{ 
var where_to= confirm("Do you really want to go to this page??"); 
if (where_to== true) 
{ 
    window.location="https://www.sandbox.paypal.com/xxxx"; 
} 
else 
{ 
    window.location="#"; 
    } 
} 
//--> 
</SCRIPT> 

這個按鈕:

<a href="javascript:void(0)" class="signup_button3" onClick="go_there()"><span class="floatbutton">Get It! $10</span></a> 

我知道這是一個涉及正確設置參數的簡單的事情,但我仍然很新並試圖找出...

我會在同一頁上有幾個按鈕,當用戶單擊按鈕時,我想要相同的彈出窗口發生,但他們將採取每個按鈕不同的PayPal結帳。你能告訴我該怎麼做嗎?

最後,彈出按鈕可以處理像無序列表的東西嗎?

謝謝! Joel

編輯:想出了我的第一個問題,所以編輯的問題...抱歉的混亂!

回答

1
<input type="button" onclick="go_there('http://...')" value="press me"> 
<script type="text/javascript"> 

function go_there(loc) 
{ 
var where_to= confirm("Do you really want to go to this page??"); 
if (where_to) 
{ 
    document.location=loc; 
} 

} 
</script> 

我不清楚你有關排序列表的部分。彈出窗口是HTML頁面,與其他任何網頁一樣。

+0

這很好。謝謝!我在哪裏可以做彈出窗口的html? – Joel

+0

代替「document.location = loc」。 「loc」將用作彈出窗口的URL。 –

相關問題