<html><head><title></title></head>
<script>var url=new String;
function gotourl()
{
    url=document.x.y.value;
    open("'http://'+url","sss")
}            
            </script><body>
<form name="x">
<input type="button" value="进入" onclick="gotourl()"/>
<input name="y" type="text" value=""/></form>
<iframe name="sss" width=300 height=400></iframe>
</body></html>

解决方案 »

  1.   

    richard_qiao 
    你好 如果我想把它应用到不同的框架上 就是说想传入frame的名字  该怎样改动以下呢
      

  2.   

    我想实现一个功能: 
    输入一个url,定位到一个页面或是frame上去. 
    ------------------------------------
    问题1:在哪里输入?!地址栏 or 文本框?!
    问题2:定位?全页面刷新 or 页面内iframe刷新?!
      

  3.   

    <HTML>
    <HEAD>
    <META http-equiv='Content-Type' content='text/html; charset=gb2312'>
    <TITLE></TITLE>
    <script>
    function ent(url)
    {
    if(url == "")
    alert("请输入URL地址!");
    else
    window.open(url,"打开窗口的名称","");// 第三个参数可以为框架名字,或是其它,具体可以参考相关手册
    }
    </script>
    </HEAD>
    <BODY >
    <input type="text" name="url" id="url" value = "输入url地址" ><br>
    <input type="button" name = "ent" value="进入" onclick="ent(document.getElementById('url').value)">
    </BODY>
    </HTML>
      

  4.   

    瞎写了一个,好像没啥实用价值,哈<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <title> new document </title>
        <meta name="generator" content="editplus" />
        <meta name="author" content="Gao YiXiang" />
        <meta name="email" content="[email protected]" />
        <meta name="keywords" content="javascript dhtml dom" />
        <meta name="description" content="I love web development." />
        <style type="text/css">
    body
    {
        margin: 0px 0px 0px 0px;
        padding: 0px 0px 0px 0px;
    }
        </style>
    </head>
    <body>
        url: <input type="text" id="tbxUrl" style="width: 200px;" value="http://www.google.cn/" /><input type="button" id="btnGo" value="GO" />
        <iframe id="ifmShow" frameborder="1" scrolling="auto" width="800" height="600"></iframe>
        <script type="text/javascript">
        <!--
    function $(sId)
    {
        return document.getElementById(sId)
    }
    $("btnGo").onclick = function()
    {
        if ($("tbxUrl").value.length>0)
        {
            $("ifmShow").src = $("tbxUrl").value;
        }
    };
        //-->
        </script>
    </body>
    </html>
      

  5.   

    yixianggao    
    ------------------------------------ 
    问题1:在哪里输入?!地址栏   or   文本框?! 
    问题2:定位?全页面刷新   or   页面内iframe刷新?! 
    ----------------------------------------------------
    我其实是想点击一个超链接,弹出一个层,层里显示这个超链接的页面
    我必须把url传进去,可是不会做了
      

  6.   

    写了一个玩!L@_@K
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <title>dhtml.div.iframe.simulatePopup.html</title>
        <meta name="generator" content="editplus" />
        <meta name="author" content="Gao YiXiang" />
        <meta name="email" content="[email protected]" />
        <meta name="keywords" content="javascript dhtml dom" />
        <meta name="description" content="I love web development." />
        <style type="text/css">
    body
    {
        margin: 0px 0px 0px 0px;
        padding: 0px 0px 0px 0px;
    }
    #divPopup
    {
        display: none;
        padding: 25px 10px 10px 10px;
        border: 1px dotted red;
        background-color: #000000;
        /* for IE. */
        filter: alpha(opacity=80);
        /* for FF. */
        opacity: 0.8;
        z-index: 101;
    }
    #ifmShow
    {
        
    }
    #hlkClose
    {
        display: block;
        position: absolute;
        top: 5px;
        right: 10px;
        color: white;
        font-size: 14px;
        line-height: 20px;
    }
        </style>
    </head>
    <body>
        url: <input type="text" id="tbxUrl" style="width: 200px;" value="http://www.126.com/" />
        <input type="button" id="btnGo" value="GO" />
        <a name="hyperlink" href="http://www.g.cn/">Google</a>
        <a name="hyperlink"  href="http://www.baidu.com/">Baidu</a>
        <h3>div模拟popup窗口,IE6sp1, FF2 测试可用!</h3>
        <pre>
    yixianggao         
    ------------------------------------   
    问题1:在哪里输入?!地址栏       or       文本框?!   
    问题2:定位?全页面刷新       or       页面内iframe刷新?!   
    ---------------------------------------------------- 
    我其实是想点击一个超链接,弹出一个层,层里显示这个超链接的页面 
    我必须把url传进去,可是不会做了
        </pre>    <div id="divPopup">
            <a id="hlkClose" href="javascript:void(0);">Close</a>
            <iframe id="ifmShow" width="800" height="500" frameborder="0" scrolling="auto"></iframe>
        </div>
        
        <script type="text/javascript">
        <!--
    function $(sId)
    {
        return document.getElementById(sId)
    }
    $("btnGo").onclick = function()
    {
        if ($("tbxUrl").value.length>0)
        {
            showFloatIframe($("tbxUrl").value, this.offsetHeight)
        }
    };function showFloatIframe(sUrl, iTop)
    {
        with ($("divPopup").style)
        {
            display= "block";
            width = $("ifmShow").width + "px";
            height = $("ifmShow").height + "px";
            position = "absolute";
            top = iTop + "px";
            left = ((parseInt(document.body.offsetWidth)-parseInt(width))/2) + "px";
        }
        $("ifmShow").src = sUrl;
    }var aLinks = document.getElementsByName("hyperlink");
    for (var i=0; i<aLinks.length; i++)
    {
        aLinks[i].onclick = function()
        {
            showFloatIframe(this.href, $("btnGo").offsetHeight);
            return false;
        };
    }$("hlkClose").onclick= function()
    {
        this.parentNode.style.display='none';
    };    //-->
        </script>
    </body>
    </html>
      

  7.   

    GG yixianggao 你好棒
    可以给我解决这最后一个问题吗:
    就是在这个层里再放一个链接,点击后弹出一个新层,里面还有一个页面~~~
    谢谢GG了,我就差这最后的一点就圆满了呀
    我的分都给你好吗
    求你了 好吧 呵呵
      

  8.   

    哦,那就改改接着弹吧!代码有点儿乱,凑合看L@_@K
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <title>dhtml.div.iframe.simulatePopup.html</title>
        <meta name="generator" content="editplus" />
        <meta name="author" content="Gao YiXiang" />
        <meta name="email" content="[email protected]" />
        <meta name="keywords" content="javascript dhtml dom" />
        <meta name="description" content="I love web development." />
        <style type="text/css">
    html
    {
        /*  
        overflow-x: hidden;*/
    }
    body
    {
        margin: 0px 0px 0px 0px;
        padding: 0px 0px 0px 0px;
    }
    #divPopup
    {
        display: none;
        text-align: center;
        padding-top: 25px;
        padding-right: 0px;
        padding-bottom: 10px;
        padding-left: 0px;
        background-color: #000000;
        /* for IE. */
        filter: alpha(opacity=80);
        /* for FF. */
        opacity: 0.8;
        z-index: 101;
    }
    #divChildPopup
    {
        display: none;
        text-align: center;
        padding-top: 25px;
        padding-right: 0px;
        padding-bottom: 10px;
        padding-left: 0px;
        background-color: #ffff00;
        /* for IE. */
        filter: alpha(opacity=80);
        /* for FF. */
        opacity: 0.8;
        z-index: 102;
    }
    #ifmShow
    {
        
    }
    #hlkClose
    {
        display: block;
        position: absolute;
        top: 5px;
        right: 10px;
        color: white;
        font-size: 14px;
        line-height: 20px;
    }
    #hlkCloseChild
    {
        display: block;
        position: absolute;
        top: 5px;
        right: 10px;
        color: black;
        font-size: 14px;
        line-height: 20px;
    }
    #hlkTarget
    {
        display: block;
        position: absolute;
        top: 5px;
        left: 10px;
        color: white;
        font-size: 14px;
        line-height: 20px;
    }
        </style>
    </head>
    <body>
        url: <input type="text" id="tbxUrl" style="width: 200px;" value="http://www.126.com/" />
        <input type="button" id="btnGo" value="GO" />
        <a name="hyperlink" href="http://www.g.cn/">Google</a>
        <a name="hyperlink"  href="http://www.baidu.com/">Baidu</a>
        <h3>div模拟popup窗口,IE6sp1, FF2 测试可用!</h3>
        <pre>
    yixianggao         
    ------------------------------------   
    问题1:在哪里输入?!地址栏 or 文本框?!   
    问题2:定位?全页面刷新 or 页面内iframe刷新?!   
    ---------------------------------------------------- 
    我其实是想点击一个超链接,弹出一个层,层里显示这个超链接的页面 
    我必须把url传进去,可是不会做了
        </pre>    <div id="divPopup">
            <a id="hlkClose" href="javascript:void(0);">Close</a>
            <iframe id="ifmShow" width="800" height="500" frameborder="0" scrolling="auto"></iframe>
            <a id="hlkTarget" href="http://www.g.cn/">G.cn</a>
            <div id="divChildPopup">
                <a id="hlkCloseChild" href="javascript:void(0);">Close</a>
                <iframe id="ifmChildShow" width="800" height="450" frameborder="0" scrolling="auto"></iframe>
            </div>
        </div>
        
        <script type="text/javascript">
        <!--
    function $(sId)
    {
        return document.getElementById(sId)
    }$("btnGo").onclick = function()
    {
        if ($("tbxUrl").value.length>0)
        {
            showParentPopup($("tbxUrl").value, this.offsetHeight)
        }
    };function showParentPopup(sUrl, iTop)
    {
        var iframeId = "ifmShow";    with ($("divPopup").style)
        {
            display= "block";
            width = document.body.offsetWidth + "px";
            height = $(iframeId).height + "px";
            position = "absolute";
            top = iTop + "px";
            // 居中。
            //((parseInt(document.body.offsetWidth)-parseInt(width))/2) + "px";
            left = "0px";
        }
        $(iframeId).src = sUrl;
    }function showChildPopup(sUrl, iTop)
    {
        var iframeId = "ifmChildShow";
        with ($("divChildPopup").style)
        {
            display= "block";
            width = document.body.offsetWidth + "px";
            height = $(iframeId).height + "px";
            position = "absolute";
            top = iTop + "px";
            // 内嵌居中。
            //((parseInt($(iframeId).parentNode.parentNode.offsetWidth)-parseInt(width))/2) + "px";
            left = "0px";
        }
        $(iframeId).src = sUrl;
    }var aLinks = document.getElementsByName("hyperlink");
    for (var i=0; i<aLinks.length; i++)
    {
        aLinks[i].onclick = function()
        {
            showParentPopup(this.href, $("btnGo").offsetHeight);
            return false;
        };
    }$("hlkClose").onclick= function()
    {
        this.parentNode.style.display='none';
    };$("hlkCloseChild").onclick= function()
    {
        this.parentNode.style.display='none';
    };$("hlkTarget").onclick= function()
    {
        showChildPopup(this.href, this.offsetTop+this.offsetHeight);
        return false;
    };    //-->
        </script>
    </body>
    </html>