我很努力地實現一個功能來打開一個帶有外部鏈接的新窗口。我正在創建動態內容,並且希望編寫一個可以打開彈出/彈出窗口的函數。請幫忙。我喜歡jquery對話框和lightwindo等,但我無法實現任何這些,任何幫助將是gerat,我堅持和沮喪與這個小小的問題。 。 。到目前爲止,沒有任何選項可用於他們。這裏是我如何顯示我的結果的代碼,以及我如何認爲我必須調用該函數才能打開一個新窗口。所以這裏的第二個功能是一個我需要一些幫助,打開顯示的信息一個不錯的彈出窗口..JavaScript彈出窗口打開外部網頁
// --------------------- display the course results -> structuring the returned array, to output all information into a table ----------------------
function displayCourses()
{
var str = ' <table border="0" width="530">' +
'<tr>' +
'<td width="150">Title/course code</td>' +
'<td>INFO</td>' +
'</tr>';
if(curCourseList == null)
{
str = str + '<tr><td colspan="2"><div id="msgDips"></div></td></tr>';
}
else
{
for (var i = 0; i < curCourseList.length; i++)
{
str = str + '<tr><td valign="top" width="150"><a style="cursor:pointer;" onclick="showCourse(\''+curCourseList[i][0]+'\')" >' + curCourseList[i][0] + ' <br /> </a>' + curCourseList[i][1] +'<br>'+ curCourseList[i][3] +'<br /><br />'+ curCourseList[i][4] +'</td><td>' + curCourseList[i][2] +'</td></tr>';
}
}
str = str + '</table>';
document.getElementById("courseContainer").innerHTML = str;
if(curCourseList == null)
{
getLangToken('99');
}
}
function showCourse(code)
{
//alert(1)
$.ajax({
async:false,
type: "POST",
url: 'formPostsUser.php?reqtype=getCourse',
data:'coursecode='+ code,
success: function(data)
{
newwindow=window.open(url,'name','height=200,width=150');
if (window.focus) {newwindow.focus()}
return false;
}
});
}
並認真任何幫助將大大AP [preciated。我在這樣深的狗屎ATM
編輯---------------
這是window.open位我會liek更換打開一個漂亮的花式流行-up,沒有新的瀏覽器窗口或頁面
,如果你在一個適當的彈出打開它你不需要的AJAX或類似的東西。只需將網址正確地放在一起,就像'var url ='http:// example.com''並調用'var newwindow = window.open(url,name,params);'完成了。根本不需要jQuery。 – Armatus 2012-04-23 17:30:09
那newwindow位,我會騙人替換,用腳本打開一個不錯的彈出窗口,而不是新的瀏覽器窗口或標籤! – 2012-04-23 17:34:52
你知道'+ ='操作符嗎? **爲什麼在的名稱中使用同步ajax請求?!** –
ThiefMaster
2012-04-23 18:32:36