2011-10-20 60 views
0

我有一個HTTP POST返回,其中包含我嘗試在另一個頁面中的框(或包含區域)中顯示的整個HTML頁面。我曾考慮將它保存爲臨時文檔,然後通過Frame或iFrame重新顯示......但這似乎令人費解。我希望有一個更優雅的解決方案。如何在完整的HTML頁面中的一個框中加載完整的HTML頁面

下面是一個HTML示例,我試圖在另一個HTML頁面中顯示,而不必先將它保存到服務器上的文件中。

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> 

<html> 

<head></head> 

<script language="javascript"> 

function openWin(page,win_width,win_height){ 

try {popup_window.close();} catch(e){}if (page.indexOf("mailto") == -1) { 

var options ="scrollbars=yes, width=" + win_width + ", height=" + win_height; 

var win = window.open(page, 'MyWin', options); 

if (window.focus) { win.focus() }}} 

</script> 



<body bgcolor="#E5E5E5"> 

<table cellspacing="0" cellpadding="0"> 

<tr> 

<td style="font-family:Arial;font-size:13px;color:#000000;font-weight:bold;">Thank You</td> 

</tr> 

<tr><td height="10px;"></td></tr> 

<tr> 

<td style="font-family:Arial;font-size:12px;color:#000000;">Representatives from the following companies will be contacting you soon.</td> 

</tr> 

<tr><td height="10px;"></td></tr> 

<tr><td><table id="someTable" cellspacing="0" cellpadding="0"> 

<tr> 

<td> 

<table cellspacing="0" cellpadding="0"> 

<tr> 

<td align="center"> 

<img src="http://someurl.com/somepic.gif" border="0" alt="TEXT" title="TEXT"/> 

</td> 

</tr> 

<tr> 

<td align="center" style="font-family:Arial;font-size:12px;color:#000000;padding-top:5px;"> 

TEXT 

</td> 

</tr> 

<tr> 

<td valign="top" align="center" style="font-family:Arial;font-size:12px;color:#000000;padding-top:5px;"> 

<a href="javascript:openWin('http://someurl.jsp','517','460');" title="More Information">More Information</a> 

</td> 

</tr> 

</table> 

</td> 

<td> 

<table cellspacing="0" cellpadding="0"> 

<tr> 

<td align="center"> 

<img src="http://someurl.com/somepic.gif" border="0" alt="TEXT" title="TEXT"/> 

</td> 

</tr> 

<tr> 

<td align="center" style="font-family:Arial;font-size:12px;color:#000000;padding-top:5px;"> 

TEXT 

</td> 

</tr> 

<tr> 

<td valign="top" align="center" style="font-family:Arial;font-size:12px;color:#000000;padding-top:5px;"> 

<a href="javascript:openWin('http://someurl.jsp','517','460');" title="More Information">More Information</a> 

</td> 

</tr> 

</table> 

</td> 

<td> 

<table cellspacing="0" cellpadding="0"> 

<tr> 

<td align="center"> 

<table cellspacing="0" cellpadding="0" width="140px;"><tr><td width="140px;"><img src="http://someurl.com/somepic.gif" border="0" alt="TEXT" title="TEXT"/></td></tr></table> 

</td> 

</tr> 

<tr> 

<td align="center" style="font-family:Arial;font-size:12px;color:#000000;padding-top:5px;"> 

Text 

</td> 

</tr> 

<tr> 

<td valign="top" align="center" style="font-family:Arial;font-size:12px;color:#000000;padding-top:5px;"> 

<a href="javascript:openWin('http://someurl.jsp','517','460');" title="More Information">More Information</a> 

</td> 

</tr> 

</table> 

</td> 

</tr> 

<tr><td height="10px;"></td></tr> 

</table></td></tr></table> 

<table style="display:none"><tr><td><input type="hidden" id="XXDataCaptureKey" value="12345" /><input type="hidden" id="DATA" value="data" /></td><tr></table> 


<!-- ******** XX RESPONSE ********* 
* KEY: 12345 
* DATA: data 
* STATUS: SUCCESS 
***************** 
--> 


</body></html> 

感謝您的關注!

+0

你就不必保存文件,你只回聲它動態地從相同的腳本,比如'< iframe src =「thispage.aspx/innerpage」>或其他。但是有一個更好的解決方案,根據你的目的,可能不那麼簡單。 – Ryan

+0

你會如何動態迴應它? – Rob

+0

使用您使用的任何服務器端語言獲取頁面的URL,並根據該部分獲取'.aspx'(或'.php'或'.cgi'或其他)和echo內容之後的部分。 – Ryan

回答

0

你可以成爲它在<對象SRC =「index.html的」 >元素

+0

如果我正確地理解了你,這是另一個我必須先保存的外部頁面。感謝你的回答。 – Rob

相關問題