SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Member
    Join Date
    Feb 2001
    Location
    Central Kentucky
    Posts
    7
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hey there folks, one question, it is probably so simple I could smack myself, but I am very new to java. I have the code worked out, I just need to know how to call it from a hyperlink on an existing page. The code is as follows:

    <script>
    window.open('http://www.mysite.net/chat.htm', 'DummyName', 'height=350,width=520', false);
    </script>

    This works fine on a page by itself, but it opens the "chat.htm" page, as well as one before it that runs the code. It would be much better to just run it from a hyperlink button from the main page and not load the first unnecessary page in the first place. Thanks for any and all help. I know this has to be something very simple that I just haven't caught/stumbled onto yet.
    Last edited by palerider; Feb 10, 2001 at 17:36.
    --==PaleRider==--

  2. #2
    SitePoint Wizard westmich's Avatar
    Join Date
    Mar 2000
    Location
    Muskegon, MI
    Posts
    2,328
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You would want to set that script as a function. Add a trigger in a hyperlink (onclick="myFunction()").
    Westmich
    Smart Web Solutions for Smart Clients
    http://www.mindscapecreative.com

  3. #3
    SitePoint Member
    Join Date
    Feb 2001
    Location
    Central Kentucky
    Posts
    7
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Okay, here's what I've got so far. It is functional and does what I want, but, I would rather it use one of my custom made buttons rather than the form element "button".You know, like an "a href" statement that is standard for clicking a link button. This would fit in much better with the site. Like I say, I am new to all of this, very new, I started playing with this java stuff only yesterday. I have done a bit of programming but that was a loooong time ago, and that was in QB 4.5 and TP 7. I have the fundamentals but blending it all with html get's me cockeyed and dizzy.
    Thanks again.


    <SCRIPT LANGUAGE="JavaScript">
    <!--
    function openURL(winName, newURL) {
    win = window.open("", winName, 'height=340,width=520', false);
    win.location.href = newURL;
    }
    // -->
    </SCRIPT>
    <FORM>
    <INPUT TYPE="button" VALUE="Enter Live Chat"
    onClick="openURL('chat', 'http://www.mysite.net/chat.htm')">
    </FORM>
    Last edited by palerider; Feb 10, 2001 at 17:35.
    --==PaleRider==--

  4. #4
    SitePoint Member JohnP's Avatar
    Join Date
    Sep 1999
    Location
    Texas
    Posts
    7
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Try this:

    <SCRIPT LANGUAGE="JavaScript">
    <!--
    function openURL(winName, newURL) {
    win = window.open("", winName, 'height=340,width=520', false);
    win.location.href = newURL;
    }
    // -->
    </SCRIPT>

    <A HREF="javascript:openURL('chat', 'http://www.mysite.net/chat.htm')"><IMG SRC="filename.gif" border="0"></A>

  5. #5
    SitePoint Member
    Join Date
    Feb 2001
    Location
    Central Kentucky
    Posts
    7
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    "<A HREF="javascript:openURL"

    That's the bit that was hanging me. Thanks a BUNCH, your help is much appreciated
    Last edited by palerider; Feb 11, 2001 at 11:22.
    --==PaleRider==--


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •