Use javascript function from other .html file

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

    Use javascript function from other .html file

    Helo!

    I have a little problem.
    My whole page (index.html) is based on one big table and an iFrame. In
    this iFrame one of the pages is a picture-thumbnail page. I found a
    javascript to open thumbnailed pictures in a really nice new window
    (it's not really a window but an iFrame, that can be moved around).
    The problem i am facing is that this window that opens picture is
    limited to the size of the index.html iFrame. If a picture is bigger
    it stays hidden in the index.html iFrame. The solution i thought of
    was that i would put the open thumbnail window script in the
    index.html file and call the function from the picture-thumbnail
    iFrame file so that it would open in index.html not inside the iFrame.
    However so far i haven't been able to find a way to call javascript
    functions from other html files. If anyone has any ideas how to solve
    this please help....

    thnx, lp john
  • HikksNotAtHome

    #2
    Re: Use javascript function from other .html file

    In article <556f1eec.04010 80442.268299b5@ posting.google. com>,
    lordslayer@volj a.net (lordslayer) writes:
    [color=blue]
    >However so far i haven't been able to find a way to call javascript
    >functions from other html files. If anyone has any ideas how to solve
    >this please help....[/color]

    parent.frames.m yFunctionName()

    In the IFrame page will call myFunctionName( ) in the main page. Except in
    Opera, I didn't play around with it enough to find a way there.
    --
    Randy

    Comment

    • lordslayer

      #3
      Re: Use javascript function from other .html file

      Does by any chance this work only for Mozilla? Because i tried it in
      IE and it didn't work... Any ideas why..?

      lp John

      Comment

      • HikksNotAtHome

        #4
        Re: Use javascript function from other .html file

        In article <556f1eec.04011 00104.7ab1f6aa@ posting.google. com>,
        lordslayer@volj a.net (lordslayer) writes:
        [color=blue]
        >Does by any chance this work only for Mozilla? Because i tried it in
        >IE and it didn't work... Any ideas why..?[/color]

        What didn't work? It is advisable to quote what you are replying to so that
        people that read it will be able to follow the conversation.

        blank.html:

        <script type="text/javascript">
        function myFunctionName( ){
        alert('It works')
        }

        <iframe src="blank2.htm l"></iframe>

        And in blank2.html:

        <a href="#" onclick="parent .frames.myFunct ionName();retur n false">Test</a>

        IE6.0: alert message
        Mozilla1.5: alert message
        Netscape7.1: alert message

        If what you are doing isn't working in Mozilla, then you are doing something
        more than what my test page uses to show that it works. Post a URL to a test
        page......

        And read the FAQ - http://www.jibbering.com/faq/
        --
        Randy

        Comment

        • lordslayer

          #5
          Re: Use javascript function from other .html file

          hikksnotathome@ aol.com (HikksNotAtHome ) wrote in message news:<200401100 75416.21642.000 03622@mb-m01.aol.com>...[color=blue]
          > In article <556f1eec.04011 00104.7ab1f6aa@ posting.google. com>,
          > lordslayer@volj a.net (lordslayer) writes:
          >[color=green]
          > >Does by any chance this work only for Mozilla? Because i tried it in
          > >IE and it didn't work... Any ideas why..?[/color]
          >
          > What didn't work? It is advisable to quote what you are replying to so that
          > people that read it will be able to follow the conversation.
          >
          > blank.html:
          >
          > <script type="text/javascript">
          > function myFunctionName( ){
          > alert('It works')
          > }
          >
          > <iframe src="blank2.htm l"></iframe>
          >
          > And in blank2.html:
          >
          > <a href="#" onclick="parent .frames.myFunct ionName();retur n false">Test</a>
          >
          > IE6.0: alert message
          > Mozilla1.5: alert message
          > Netscape7.1: alert message
          >
          > If what you are doing isn't working in Mozilla, then you are doing something
          > more than what my test page uses to show that it works. Post a URL to a test
          > page......
          >
          > And read the FAQ - http://www.jibbering.com/faq/[/color]


          Helo!

          I tried what you suggested and it still works only in Mozilla.
          I put my page online at


          If you click on "photo" link, there is a thumbnail that opens full
          picture correctly only if you use Mozilla .. IE doesn't open it right
          .... it still opens it in the iFrame.

          "Index.html " contains the javascript. "Foto.html" contains the link to
          the javascript in index.html

          Maybe if you see it you might better understand my problem... I thank
          you again for your help.

          lp john

          Comment

          • lordslayer

            #6
            Re: Use javascript function from other .html file

            lordslayer@volj a.net (lordslayer) wrote in message news:<556f1eec. 0401120027.2800 29e2@posting.go ogle.com>...[color=blue]
            > hikksnotathome@ aol.com (HikksNotAtHome ) wrote in message news:<200401100 75416.21642.000 03622@mb-m01.aol.com>...[color=green]
            > > In article <556f1eec.04011 00104.7ab1f6aa@ posting.google. com>,
            > > lordslayer@volj a.net (lordslayer) writes:
            > >[color=darkred]
            > > >Does by any chance this work only for Mozilla? Because i tried it in
            > > >IE and it didn't work... Any ideas why..?[/color]
            > >
            > > What didn't work? It is advisable to quote what you are replying to so that
            > > people that read it will be able to follow the conversation.
            > >
            > > blank.html:
            > >
            > > <script type="text/javascript">
            > > function myFunctionName( ){
            > > alert('It works')
            > > }
            > >
            > > <iframe src="blank2.htm l"></iframe>
            > >
            > > And in blank2.html:
            > >
            > > <a href="#" onclick="parent .frames.myFunct ionName();retur n false">Test</a>
            > >
            > > IE6.0: alert message
            > > Mozilla1.5: alert message
            > > Netscape7.1: alert message
            > >
            > > If what you are doing isn't working in Mozilla, then you are doing something
            > > more than what my test page uses to show that it works. Post a URL to a test
            > > page......
            > >
            > > And read the FAQ - http://www.jibbering.com/faq/[/color]
            >
            >
            > Helo!
            >
            > I tried what you suggested and it still works only in Mozilla.
            > I put my page online at
            > http://users.volja.net/lordslayer/page/index.html
            >
            > If you click on "photo" link, there is a thumbnail that opens full
            > picture correctly only if you use Mozilla .. IE doesn't open it right
            > ... it still opens it in the iFrame.
            >
            > "Index.html " contains the javascript. "Foto.html" contains the link to
            > the javascript in index.html
            >
            > Maybe if you see it you might better understand my problem... I thank
            > you again for your help.
            >
            > lp john[/color]

            Success!!! I've made this damn thing work... It wasn't your
            suggestion's fault it was my damn javascript. I located and removed
            the mistake so it works great now... Thanx again for the advice about
            the function call....

            lp john

            Comment

            Working...