Alright, now I am downright bewildered on what is happening.  I am creating a safari extension called unibar(which is a separate toolbar extension, not a t开发者_JS百科oolbar item), a clone of Chrome's address bar.  what I want so far is to at least create a regular address bar, and build from there.  Here is my bar.html file, which is connected to the toolbar.
<html>
    <head>
        <title>Unibar</title>
        <script type="text/javascript">
            function openInTab(source){
                safari.application.activeBrowserWindow.activeTab.url=source;
                }
        </script>
    </head>
    <body>
        <form name="form" onsubmit="javascript:openInTab(server+'safari/');">
            <input type="text" name="textfield" />
        </form>
    </body>
</html>
When I hit enter after I have typed in my address, IT BRINGS UP BAR.HTML IN THE BROWSER WINDOW!!!! What is happening?!?
Remove javascript: and add return false;.
Ah! I have found the answer. I idiotically forgot to declare what "server" is in the code. Here is my new code.
<html>
<head>
    <title>Unibar</title>
    <script type="text/javascript">
    function openInTab(source){
        safari.application.activeBrowserWindow.activeTab.url=source;
        }
    </script>
</head>
<body>
<form name="form">
<input type="text" name="textfield" />
<input type="button" value="Go!" onclick="javascript:openInTab(document.form.textfield.value);" />
</form>
</body>
</html>
                                        
                                        
                                        
                                        
                                        
                                        
                                        
                                        
 加载中,请稍侯......
      
精彩评论