Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Page 1 of 2 12 LastLast
Results 1 to 15 of 21
  1. #1
    Senior Coder
    Join Date
    Apr 2003
    Location
    Canada
    Posts
    1,063
    Thanks
    2
    Thanked 0 Times in 0 Posts

    script not working in firebird

    This script is working fine in IE, but not in firebird, what's the problem?
    Here is the complete page:

    Code:
    <html>
    <head>
    <title>edit</title>
    <style type="text/css">
    <!--
    
    body { background-color: #f1f1f1; }
    p { font-family: Tempus Sans ITC, verdana, helvetica, arial; }
    
    -->
    </style>
    <script type="text/javascript">
    <!--
    
    function change()
    {
    parent.show.location.reload()
    parent.show.document.write(myForm.code.value);
    return false;
    }
    
    function full()
    {
    w_height=screen.availHeight;
    w_width=screen.availWidth;
    Test=window.open('','','height=' + w_height + ',width=' + w_width + ',left=0,top=0,resizable=1');
    Test.document.write(myForm.code.value);
    return false;
    }
    
    -->
    </script>
    </head>
    <body>
    
    <p>
    By pressing the '<b>Change code</b>' button at the bottom of this page, the code you entered in the text area will appear in the frame to the right.  Or you can press the '<b>Make fullscreen</b>' button to see the result in a full size, seperate window.
    
    </p>
    <form name="myForm">
    <textarea style="width:100%" rows="26" cols="42" name="code">
    </textarea>
    <input type="button" value="Change code" onClick="change()" />
    <input type="button" value="Make fullscreen" onClick="full()" />
    </form>
    
    </body>
    </html>
    I just made this so I could create my web pages and test them directly in the other frame (kind of like the try it yourself windows at w3schools ex)
    So yeah, I'm just trying to figure out why firebird wont take it (basically because I want to create my pages for firebird and then hack them so they work in IE instead of the contrary)
    Shawn

  • #2
    Regular Coder
    Join Date
    Jan 2004
    Location
    Maryland
    Posts
    468
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Start by click tools then javascript console. That should give you a hint as to where the problem is.

  • #3
    Senior Coder
    Join Date
    Apr 2003
    Location
    Canada
    Posts
    1,063
    Thanks
    2
    Thanked 0 Times in 0 Posts
    Thanks a lot, but I really can't make anything of what it says. for example, what does this mean:

    Error: uncaught exception: [Exception... "Component returned failure code: 0x8000ffff (NS_ERROR_UNEXPECTED) [nsIPrefBranch.getIntPref]" nsresult: "0x8000ffff (NS_ERROR_UNEXPECTED)" location: "JS frame :: chrome://cookie/content/cookieTasksOverlay.xul :: CookieTasksStartup :: line 84" data: no]
    Shawn

  • #4
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,068
    Thanks
    0
    Thanked 256 Times in 252 Posts
    You're not referencing the form and frame properly.

    parent.frames['show'].document.write(document.myForm.code.value);
    ...
    Test.document.write(document.myForm.code.value);
    Glenn
    ____________________________________

    My Blog
    Tower of Hanoi Android app (FREE!)
    Tower of Hanoi Leaderboard
    Samegame Facebook App
    vBulletin Plugins
    ____________________________________

  • #5
    Regular Coder
    Join Date
    Jan 2004
    Location
    Maryland
    Posts
    468
    Thanks
    0
    Thanked 0 Times in 0 Posts
    That's wierd. Ussually I get good info from there, but that makes no sence to me at least.

  • #6
    Senior Coder
    Join Date
    Apr 2003
    Location
    Canada
    Posts
    1,063
    Thanks
    2
    Thanked 0 Times in 0 Posts
    Works great! Thanks
    Shawn

  • #7
    Senior Coder
    Join Date
    Apr 2003
    Location
    Canada
    Posts
    1,063
    Thanks
    2
    Thanked 0 Times in 0 Posts
    Another problem though..
    When I click the "change code" button and it executes the change() function, firebird wont reload() the page... why?
    Shawn

  • #8
    Senior Coder
    Join Date
    Apr 2003
    Location
    Canada
    Posts
    1,063
    Thanks
    2
    Thanked 0 Times in 0 Posts
    Does anybody know why?
    here is the new and improved code
    Code:
    <html>
    <head>
    <title>edit</title>
    <style type="text/css">
    <!--
    
    body { background-color: #f1f1f1; }
    p { font-family: Tempus Sans ITC, verdana, helvetica, arial; }
    
    -->
    </style>
    <script type="text/javascript">
    <!--
    
    function change()
    {
    parent.frames['show'].document.location.reload();
    parent.frames['show'].document.write(document.myForm.code.value);
    return false;
    }
    
    function full()
    {
    w_height=screen.availHeight;
    w_width=screen.availWidth;
    Test=window.open('','','height=' + w_height + ',width=' + w_width + ',left=0,top=0,resizable=1');
    Test.document.write(document.myForm.code.value);
    return false;
    }
    
    -->
    </script>
    </head>
    <body>
    
    <p>
    By pressing the 'Change code' button at the bottom of this page, the code you entered in the text area will appear in the frame to the right.  Or you can press the 'Make fullscreen' button to see the result in a full size, seperate window.
    </p>
    <form name="myForm">
    <textarea style="width:100%" rows="26" cols="42" name="code">
    </textarea>
    <input type="button" value="Change code" onClick="change()" />
    <input type="button" value="Make fullscreen" onClick="full()" />
    </form>
    
    </body>
    </html>
    Anyone see anything wrong in here?
    Shawn

  • #9
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,068
    Thanks
    0
    Thanked 256 Times in 252 Posts
    location is not a property of document but the window.

    parent.frames['show'].location.reload();
    Glenn
    ____________________________________

    My Blog
    Tower of Hanoi Android app (FREE!)
    Tower of Hanoi Leaderboard
    Samegame Facebook App
    vBulletin Plugins
    ____________________________________

  • #10
    Senior Coder
    Join Date
    Apr 2003
    Location
    Canada
    Posts
    1,063
    Thanks
    2
    Thanked 0 Times in 0 Posts
    Darn it, thank you.

    Do you mind checking out this thread, I can't seem to get any answers..
    Thanks again for that location thing
    Shawn

  • #11
    Senior Coder
    Join Date
    Apr 2003
    Location
    Canada
    Posts
    1,063
    Thanks
    2
    Thanked 0 Times in 0 Posts
    oh, and after testing, the script still doesn't work...
    Shawn

  • #12
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,068
    Thanks
    0
    Thanked 256 Times in 252 Posts
    But why do you reload the page in the first place? Why not just write out the new page in that frame instead?
    Glenn
    ____________________________________

    My Blog
    Tower of Hanoi Android app (FREE!)
    Tower of Hanoi Leaderboard
    Samegame Facebook App
    vBulletin Plugins
    ____________________________________

  • #13
    Senior Coder
    Join Date
    Apr 2003
    Location
    Canada
    Posts
    1,063
    Thanks
    2
    Thanked 0 Times in 0 Posts
    Your right, I guess I'm sticking to an old method even if it don't work...
    I wouldn't know how to do though. would it be with the open() function?

    And just out of curiosity, why didn't the reload() work?
    Shawn

  • #14
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,068
    Thanks
    0
    Thanked 256 Times in 252 Posts
    document.write is enough. It already calls document.open internally.

    function change()
    {
    parent.frames['show'].document.write(document.myForm.code.value);
    return false;
    }

    I think the reload works. It's just that you don't see it because the page is immediately replaced by the new page.
    Glenn
    ____________________________________

    My Blog
    Tower of Hanoi Android app (FREE!)
    Tower of Hanoi Leaderboard
    Samegame Facebook App
    vBulletin Plugins
    ____________________________________

  • #15
    Senior Coder
    Join Date
    Apr 2003
    Location
    Canada
    Posts
    1,063
    Thanks
    2
    Thanked 0 Times in 0 Posts
    The reason why I want it to reload is because I want the page to become blank again before it writes the code. If I only use document.write() , say I make it write "hello", if I do it again but change "hello" to "ouch", the page will show

    Hello

    ouch

    I want it to show only ouch, that's why I want the page to reload (become blank) and then write.
    Am I making any sence?
    Shawn


  •  
    Page 1 of 2 12 LastLast

    Posting Permissions

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