Loading ...
Sorry, an error occurred while loading the content.

Re: Problem with a function

Expand Messages
  • davidrmd
    Alph, The problem is with the code. For one thing you have 1 too many variables. Try this instead: function open(url){
    Message 1 of 3 , Aug 25, 2002
    • 0 Attachment
      Alph,

      The problem is with the <head> code. For one thing you have 1 too
      many variables. Try this instead:

      <script language="javascript">
      function open(url){
      window.open(url);
      }
      </script>

      You may also need to use the full URL in the "javascript:open" link in
      the body (i.e. http://www.yourdomain.com/images/008.html -- or
      whatever).

      Best,
      David

      --- In javascript3@y..., "kjhseka" <kjhseka@h...> wrote:
      > hello, I have problem with the following code.
      >
      > In the head section I have :
      >
      > <script language="JavaScript">
      > <!--
      > var OpenNewWindow;
      > function Open(var source)
      > {
      > OpenNewWindow = window.open(source);
      > }
      > -->
      > </script>
      >
      > And in my body section :
      >
      > <td><a href="javascript:Open('images/008.html')">
      > <img src="images/oriental1.jpg" width="85"></a><br></td>
      >
      > (this code is inside of a table).
      >
      > So why I get always the error "Identifier expected or object
      > expected"?
      >
      > Thanks, I will appreciate if you can help
      >
      > Alph
    • kjhseka
      The problem was really the use of var in the argument list. For me it seemed more logical to use var, because in the fonction definition, the arguments apperas
      Message 2 of 3 , Aug 25, 2002
      • 0 Attachment
        The problem was really the use of var in the argument list. For me it
        seemed more logical to use var, because in the fonction definition,
        the arguments apperas for the first time.
        Influence from stronger typed programming languages...

        Alph

        --- In javascript3@y..., davidrmd <no_reply@y...> wrote:
        > Alph,
        >
        > The problem is with the <head> code. For one thing you have 1
        too
        > many variables. Try this instead:
        >
        > <script language="javascript">
        > function open(url){
        > window.open(url);
        > }
        > </script>
        >
        > You may also need to use the full URL in the "javascript:open" link
        in
        > the body (i.e. http://www.yourdomain.com/images/008.html -- or
        > whatever).
        >
        > Best,
        > David
        >
        > --- In javascript3@y..., "kjhseka" <kjhseka@h...> wrote:
        > > hello, I have problem with the following code.
        > >
        > > In the head section I have :
        > >
        > > <script language="JavaScript">
        > > <!--
        > > var OpenNewWindow;
        > > function Open(var source)
        > > {
        > > OpenNewWindow = window.open(source);
        > > }
        > > -->
        > > </script>
        > >
        > > And in my body section :
        > >
        > > <td><a href="javascript:Open('images/008.html')">
        > > <img src="images/oriental1.jpg" width="85"></a><br></td>
        > >
        > > (this code is inside of a table).
        > >
        > > So why I get always the error "Identifier expected or object
        > > expected"?
        > >
        > > Thanks, I will appreciate if you can help
        > >
        > > Alph
      Your message has been successfully submitted and would be delivered to recipients shortly.