How to change textbox words in another frame in different domain?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • perhapscwk
    New Member
    • Sep 2007
    • 123

    How to change textbox words in another frame in different domain?

    For example, i have 2 frame, one in left side and one in right side.

    for the right side frame, i can;t alter the code in the right frame and i just know
    it have a textbox id=customer

    then i want to write a left frame by myself and when i click the button,
    the right frame textbox word will change as what I set.

    Is it possible?
  • acoder
    Recognized Expert MVP
    • Nov 2006
    • 16032

    #2
    Welcome to TSDN!

    Yes, it is possible. See this link. If you get stuck, post your code.

    Comment

    • perhapscwk
      New Member
      • Sep 2007
      • 123

      #3
      It not works...help...

      This one is the index.htm file
      [HTML]<HTML>
      <HEAD>
      <TITLE>main</TITLE>

      </HEAD>
      <FRAMESET cols="20%, 80%">
      <FRAME name=left src="main.htm">
      <FRAME name=right src="aaaaa.htm" >
      </FRAMESET>
      </html>
      [/HTML]

      This one is main.htm
      [HTML]<button
      onclick="parent .right.document .getElementById ('cellright').i nnerHTML=
      'New words'">
      Change</button>
      [/HTML]
      This one is the file aaaaa.htm
      [HTML]<input type="text" size="14" id="cellright" value="Hello"></input>[/HTML]

      For aaaaa.htm, I don;t want to modify it...but when i click the button in main.htm..it suppose the textbox in aaaaa.htm should change from "Hello" to "New words"...HELP.

      thanks.
      Last edited by acoder; Sep 7 '07, 08:36 AM. Reason: Added code tags

      Comment

      • acoder
        Recognized Expert MVP
        • Nov 2006
        • 16032

        #4
        Change the code to:[HTML]<button onclick="parent .right.document .getElementById ('cellright').v alue='New words'">Change</button>[/HTML]

        Comment

        • perhapscwk
          New Member
          • Sep 2007
          • 123

          #5
          I try to make the gmail.com as the right frame, and there have a textbox username and password...for the password textbox..it id is "Passwd".

          So in left frame, i use

          [HTML]<button onclick="parent .right.document .getElementById ('Passwd'). value='1234567' ">add pwd</button>[/HTML]

          But it not works? Why?
          Last edited by gits; Sep 12 '07, 06:42 AM. Reason: added code tags

          Comment

          • acoder
            Recognized Expert MVP
            • Nov 2006
            • 16032

            #6
            The frame is from a different domain. Try a page from the same domain.

            Comment

            • perhapscwk
              New Member
              • Sep 2007
              • 123

              #7
              We can;t do anything if it is from a different domain?

              Comment

              • acoder
                Recognized Expert MVP
                • Nov 2006
                • 16032

                #8
                Originally posted by perhapscwk
                We can;t do anything if it is from a different domain?
                Well, you may find one or two workarounds, but no, because of security restrictions, cross-domain scripting is not possible.

                Comment

                • perhapscwk
                  New Member
                  • Sep 2007
                  • 123

                  #9
                  input information to textbox in different domain?

                  Is there any ways we can make something to help us input information to
                  textbox which in different domain?

                  Comment

                  • gits
                    Recognized Expert Moderator Expert
                    • May 2007
                    • 5388

                    #10
                    hi ...

                    moved from js-article-section to the forum-section ... please don't post questions in the articles-section ...

                    kind regards

                    Comment

                    • dmjpro
                      Top Contributor
                      • Jan 2007
                      • 2476

                      #11
                      Originally posted by perhapscwk
                      Is there any ways we can make something to help us input information to
                      textbox which in different domain?
                      Be specific little bit more!

                      Kind regards,
                      Dmjpro.

                      Comment

                      • acoder
                        Recognized Expert MVP
                        • Nov 2006
                        • 16032

                        #12
                        Originally posted by perhapscwk
                        Is there any ways we can make something to help us input information to
                        textbox which in different domain?
                        This is not possible due to security restrictions. See this link.

                        Comment

                        • perhapscwk
                          New Member
                          • Sep 2007
                          • 123

                          #13
                          I try to make the gmail.com as the right frame, and there have a textbox username and password...for the password textbox..it id is "Passwd".

                          So in left frame, i use


                          [HTML]<button onclick="parent .right.document .getElementById ('Passwd'). value='1234567' ">add pwd</button>[/HTML]

                          However it not works....i have been told the problem is because the script will work only if it in the same domain.

                          I want to ask is there any others ways i can do for it?

                          thanks very much.
                          Last edited by gits; Sep 13 '07, 12:24 PM. Reason: added code tags

                          Comment

                          • dmjpro
                            Top Contributor
                            • Jan 2007
                            • 2476

                            #14
                            Originally posted by perhapscwk
                            I try to make the gmail.com as the right frame, and there have a textbox username and password...for the password textbox..it id is "Passwd".

                            So in left frame, i use


                            [HTML]<button onclick="parent .right.document .getElementById ('Passwd'). value='1234567' ">add pwd</button>[/HTML]

                            However it not works....i have been told the problem is because the script will work only if it in the same domain.

                            I want to ask is there any others ways i can do for it?

                            thanks very much.
                            You are sure that the password field is Passwd?
                            I think you are sure.
                            And I assume that right frame name is right.

                            Now try this, I think it will work........... !
                            [code=javascript]
                            parent.document .frames['right'].document.getEl ementById('Pass wd').value='123 4567';
                            [/code]
                            Good Luck!

                            Kind regards,
                            Dmjpro.

                            Comment

                            • perhapscwk
                              New Member
                              • Sep 2007
                              • 123

                              #15
                              it not works.......... ....

                              Comment

                              Working...