How do I "convert" this to a "function"?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Michael Stevens

    How do I "convert" this to a "function"?

    Probably the wrong wording but since I'm not a scripter I won't claim
    to know what I'm talking about.

    I got this script from www.htmlgoodies.com

    <script language="JavaS cript">
    <!--
    window.open ('photos01.html ','photogallery ',config='heigh t=550,
    width=750,toolb ar=no, menubar=no, scrollbars=no, resizable=no,
    location=no, directories=no, status=no');
    -->
    </SCRIPT>

    Obviously, it opens a new browser window with my Photo Gallery in it.

    How do I convert it into a "function" in the <head> section to call
    later from a link or from within a Flash movie? And, what is the
    wording that I would use to call it that would be placed in the <a
    href="javascrip t:??> section?

    Thanks for the help!

    Mike


    ----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
    http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
    ---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =---
  • Mosley Jones III

    #2
    Re: How do I &quot;convert&q uot; this to a &quot;function& quot;?


    "Michael Stevens" <bigmikeatbigmi kesdotorg> wrote in message
    news:h8n3ivc3l9 bd6s03ktu2v4up3 g62kmmn8l@4ax.c om...[color=blue]
    > Probably the wrong wording but since I'm not a scripter I won't claim
    > to know what I'm talking about.
    >
    > I got this script from www.htmlgoodies.com
    >
    > <script language="JavaS cript">
    > <!--[/color]
    ]


    function winOpen()

    {

    window.open ('photos01.html ','photogallery ',config='heigh t=550,
    width=750,toolb ar=no, menubar=no, scrollbars=no, resizable=no,
    location=no, directories=no, status=no');

    }


    or better still

    function winOpen(url)

    {

    window.open ( url ,'photogallery' ,config='height =550,
    width=750,toolb ar=no, menubar=no, scrollbars=no, resizable=no,
    location=no, directories=no, status=no');

    }

    [color=blue]
    > -->
    > </SCRIPT>[/color]


    you can call like this

    <a href=javascript : winOpen('photos 01.html') > mylink </a>




    [color=blue]
    >
    > Obviously, it opens a new browser window with my Photo Gallery in it.
    >
    > How do I convert it into a "function" in the <head> section to call
    > later from a link or from within a Flash movie? And, what is the
    > wording that I would use to call it that would be placed in the <a
    > href="javascrip t:??> section?
    >
    > Thanks for the help!
    >
    > Mike
    >
    >
    > ----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet[/color]
    News==----[color=blue]
    > http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000[/color]
    Newsgroups[color=blue]
    > ---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption[/color]
    =---


    Comment

    • Michael Stevens

      #3
      Re: How do I &quot;convert&q uot; this to a &quot;function& quot;?

      On Sat, 26 Jul 2003 18:23:37 +0800, "Mosley Jones III"
      <me@info.gov.ma rs> woke me from my slumber by saying:
      [color=blue]
      >or better still
      >
      >function winOpen(url)
      >{
      > window.open ( url ,'photogallery' ,config='height =550,
      > width=750,toolb ar=no, menubar=no, scrollbars=no, resizable=no,
      > location=no, directories=no, status=no');
      >}
      > -->
      > </SCRIPT>
      >
      >you can call like this
      >
      ><a href=javascript : winOpen('photos 01.html') > mylink </a>[/color]

      So, again remember my ignorance, in javascript the window.open
      function has basically three variables (url, name, config) and they
      appear in that order so that in your "better" example since url is not
      inside ' ' the function assumes that the variable, in this case the
      url, will be supplied when called from a link? Just so I know what's
      going on. It's easier to mess with when you know what's going on.

      Thanks for the help!

      Mike


      ----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
      http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
      ---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =---

      Comment

      • Michael Stevens

        #4
        Re: How do I &quot;convert&q uot; this to a &quot;function& quot;?

        On 26 Jul 2003 04:38:40 +0200, Lasse Reichstein Nielsen
        <lrn@hotpop.com > woke me from my slumber by saying:
        [color=blue]
        >Michael Stevens <bigmikeatbigmi kesdotorg> writes:
        >[color=green]
        >> Probably the wrong wording but since I'm not a scripter I won't claim
        >> to know what I'm talking about.
        >>
        >> I got this script from www.htmlgoodies.com
        >>
        >> <script language="JavaS cript">
        >> <!--
        >> window.open ('photos01.html ','photogallery ',config='heigh t=550,
        >> width=750,toolb ar=no, menubar=no, scrollbars=no, resizable=no,
        >> location=no, directories=no, status=no');
        >> -->
        >> </SCRIPT>[/color]
        >
        >Not impressive code.[/color]

        I don't know that it is supposed to be ...
        [color=blue][color=green]
        >> Obviously, it opens a new browser window with my Photo Gallery in it.
        >>
        >> How do I convert it into a "function" in the <head> section to call
        >> later from a link or from within a Flash movie?[/color]
        >
        >Don't know about Flash, but if you want to call it from a link, you might
        >want to call it from more than one link, so I have made the actual URL
        >an argument of the function.
        >
        >This should be what you need:
        >
        ><script type="text/javascript">
        >function myOpenWindow(ur l) {
        > window.open(url ,"photogallery" ,"heigth=550,wi dth=750,toolbar =no,"+
        > "menubar=no,scr ollbars=no,resi zable=no,locati on=no,"+
        > "directories=no ,status=no");
        >}
        ></script>
        >
        >Every change compared to the original is deliberate and for the better.
        >[color=green]
        >> And, what is the wording that I would use to call it that would be
        >> placed in the <a href="javascrip t:??> section?[/color]
        >
        >Don't use "href='javascri pt:...'" (it's in the FAQ, which is sadly down
        >at the moment: <URL:http://jibbering.com/faq/>.
        >Instead:
        >
        ><a href="photos01. html" target="photoga llery"
        > onclick="myOpen Window(this.hre f);return false;">
        >link text</a>(opens in new window)
        >
        >Make it obvious that clicking this link will open a new window.
        >Make sure that people without javascript can also use the page.[/color]

        Actually, that's a good idea. I don't know how that will be
        implemented in Flash but I'll have to do some checking & playing
        around to see how to make it work.

        One question: if someone doesn't have javascript enabled how will they
        be able to use the page? Your HREF doesn't have a "JavaScript:... " in
        it but that doesn't change the fact that it is calling a JavaScript
        function, does it?

        Thanks,

        Mike


        ----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
        http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
        ---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =---

        Comment

        • Lasse Reichstein Nielsen

          #5
          Re: How do I &quot;convert&q uot; this to a &quot;function& quot;?

          Michael Stevens <bigmikeatbigmi kesdotorg> writes:
          [color=blue]
          > One question: if someone doesn't have javascript enabled how will they
          > be able to use the page? Your HREF doesn't have a "JavaScript:... " in
          > it but that doesn't change the fact that it is calling a JavaScript
          > function, does it?[/color]

          If they don't have javascript (or it isn't enabled) then it will act
          as a normal link with a target. The page whose URL is in the "href"
          attribute, is openend in a new window with the name taken from the
          "target" attribute. The javascript is never executed. The only thing
          that the javascript does is to add the "config" part of the window.open
          call, to change the initial size and properties of the new window.
          Without javascript, you just get a plain new window, but it works.

          /L
          --
          Lasse Reichstein Nielsen - lrn@hotpop.com
          Art D'HTML: <URL:http://www.infimum.dk/HTML/randomArtSplit. html>
          'Faith without judgement merely degrades the spirit divine.'

          Comment

          • Michael Stevens

            #6
            Re: How do I &quot;convert&q uot; this to a &quot;function& quot;?

            On 27 Jul 2003 13:12:46 +0200, Lasse Reichstein Nielsen
            <lrn@hotpop.com > woke me from my slumber by saying:
            [color=blue]
            >Michael Stevens <bigmikeatbigmi kesdotorg> writes:
            >[color=green]
            >> One question: if someone doesn't have javascript enabled how will they
            >> be able to use the page? Your HREF doesn't have a "JavaScript:... " in
            >> it but that doesn't change the fact that it is calling a JavaScript
            >> function, does it?[/color]
            >
            >If they don't have javascript (or it isn't enabled) then it will act
            >as a normal link with a target. The page whose URL is in the "href"
            >attribute, is openend in a new window with the name taken from the
            >"target" attribute. The javascript is never executed. The only thing
            >that the javascript does is to add the "config" part of the window.open
            >call, to change the initial size and properties of the new window.
            >Without javascript, you just get a plain new window, but it works.
            >
            >/L[/color]

            Cool.

            As I was pondering how to execute that in Flash it dawned on me that I
            probably won't have to worry about it. There seem to be those people
            that disable everything but plain old html. So, if they're viewing the
            Flash file chances are pretty good that they have javascript enabled
            as well as their Flash plugin.

            Thanks again,

            Mike


            ----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
            http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
            ---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =---

            Comment

            Working...