Professional Web Applications Themes

JavaScript Question: Easy one hopefully. - Coldfusion - Advanced Techniques

Hi guys, In my *.js file, how do I may this: window.location = "sounds/lets_play.mp3"; open in a separate new window, as if I were putting a "_blank" target in an <a href> tag? Mike...

  1. #1

    Default JavaScript Question: Easy one hopefully.


    Hi guys,

    In my *.js file, how do I may this:

    window.location = "sounds/lets_play.mp3";

    open in a separate new window, as if I were putting a "_blank" target in an <a href> tag?

    Mike
    mikehump Guest

  2. #2

    Default Re: JavaScript Question: Easy one hopefully.

    To open in a new window, you use:
    window_handle =
    window.open('location','window_name','width=300,he ight=200,resizable=yes');
    more info on window.open:
    http://msdn.microsoft.com/workshop/author/dhtml/reference/methods/open_0.asp

    But what are you trying to do - play the sound, offer it for download, or
    something else?

    boughtonp Guest

  3. #3

    Default Re: JavaScript Question: Easy one hopefully.

    >>But what are you trying to do - play the sound, offer it for download, or
    something else?

    Hi Peter,

    I have a new on-line game: Who wants to be a Catholic.

    If you click on this page below:


    http://www.cpats.org/whowantstobe/005GameContinuation.cfm?UniqueVisitorID=39CD98
    41-2C58-47FB-9F95FEAA0685FD72&CFID=17427969&CFTOKEN=731080

    where it says, at the bottom: Let's play "Who wants to be a Catholic!"

    The OnUnload function is executed, but covers the main game playing window
    instead of opening in a separate
    window.

    Try it and tell me if you understand my problem better.

    Mike

    mikehump Guest

  4. #4

    Default Re: JavaScript Question: Easy one hopefully.

    Ok, so you want it to play as they click on the link?

    In that case, I think it might be wise to use frames instead - you'd have a
    100% width frame with the current page in, and a 0% width page with a media
    player object in.
    Then you could add an onmousedown event to the link to start the media player
    playing, whilst the link itself changes the page in main frame.

    Something along the lines of the following, except I haven't done frames in
    ages so I've probably done something wrong there.

    frame.cfm
    ---------
    <frameset rows="0,*" frameborder="0">
    <frame name="sound" src="sound.cfm"/>
    <frame name="main" src="game1.cfm"/>
    </frameset>

    game1.cfm
    ---------
    <script type="text/javascript" src="game.js"></script>

    ...

    <a href="game2.cfm" target="main" onmousedown="playSound()">


    game.js
    -------
    function playSound()
    {
    top.sound.mPlayer.controls.play();
    }

    sound.cfm
    ---------
    <object id="mPlayer" classid="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6">
    <param name="URL" value="sounds/lets_play.mp3"/>
    <param name="AutoStart" value="false"/>
    <param name="uiMode" value="invisible"/>
    </object>

    boughtonp Guest

  5. #5

    Default Re: JavaScript Question: Easy one hopefully.

    Hi Peter,

    Let me try to work on what you have given me. There has got be an easier way then
    frames.

    Thanks for your input.

    Mike

    Maybe I could switch from OnUnload to OnLoad?
    mikehump Guest

  6. #6

    Default Re: JavaScript Question: Easy one hopefully.

    Until someone comes along with a better solution, I thing I'll have to take the
    sound out.


    For those new visitors to this question. I just want to click ONE hyperlink in
    a non-frame
    window and have two windows open, 1. for game play, 2. for the sound.

    Mike

    mikehump Guest

Similar Threads

  1. very easy question here, plz help me!!!
    By deb_23 in forum Macromedia Flash Actionscript
    Replies: 1
    Last Post: February 13th, 03:23 AM
  2. easy question: How do you have to the web?
    By Dave in forum Macromedia Fireworks
    Replies: 4
    Last Post: October 20th, 04:33 PM
  3. Easy question = easy answer?
    By Jyry webforumsuser@macromedia.com in forum Macromedia Freehand
    Replies: 4
    Last Post: September 29th, 03:29 PM
  4. Easy Question ??
    By mark in forum Microsoft Access
    Replies: 1
    Last Post: July 24th, 12:28 PM
  5. Easy Question/Easy Answer
    By ChuckyJ webforumsuser@macromedia.com in forum Macromedia Dreamweaver
    Replies: 1
    Last Post: July 12th, 01:50 AM

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
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139