0

我想在登录我的公司网站时显示一个欢迎页面。目前此页面有一些帐户摘要数据/详细信息。我希望能够使用相同的空间来显示帐单信息,但我不希望用户离开他们所在的页面。

我怎样才能做到这一点?我必须能够将代码放在已经加载的页面中。

4

4 回答 4

3

You can use an iframe like this:

<iframe src="http://www.w3schools.com"></iframe>

The src="blahblah" can be switched to any website or page you would like.

Although an iframe doesn't sound like something that works for what you need. It sounds like you need to add content depending on whether it is their first time visiting the page. You could use php or javascript to grab the cookies and do this.

于 2013-10-02T17:27:21.007 回答
1
var div = document.getElementById ("your_div_ID_goes_here");
div.innerHTML = "<b>Any html content. <br> Enjoy!</b>";

这会帮助你:)

于 2013-10-02T17:24:21.977 回答
0

Here's the code to load content from other URL dynamically (AJAX). You do not need jQuery just for this simple task

function loadXMLDoc(aURL){
    var xmlhttp;
    if (window.XMLHttpRequest){// code for IE7+, Firefox, Chrome, Opera, Safari
        xmlhttp=new XMLHttpRequest();
    }
    else{// code for IE6, IE5
        xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
    }
    xmlhttp.onreadystatechange=function(){
        if (xmlhttp.readyState==4 && xmlhttp.status==200){
             var div = document.getElementById ("your_div_ID_goes_here");
             div.innerHTML = xmlhttp.responseText; // this is the content you received,
        }
    }
    xmlhttp.open("GET",aURL,true);
    xmlhttp.send();

}
于 2013-10-02T17:27:38.400 回答
0

您必须对页面进行 ajax 调用以获取数据并将响应附加到要显示的 div 中。

使用 jquery $.ajax

于 2013-10-02T17:23:14.123 回答