www.webdeveloper.com
Results 1 to 12 of 12

Thread: Javascript with Iframes

  1. #1
    Join Date
    Dec 2009
    Location
    NY
    Posts
    8

    Smile Javascript with Iframes

    Hi everyone, I am new to the whole javascript scene, but i know html and php pretty well, i use dreamweaver as my editor.

    I am designing a Raid Page for a game, it is suppose to open multiple iframes with a captcha so me and my crew can type captchas faster to join God raids, so far the script is working but i am having trouble removing the scroll bars on the iframes, and im trying to target the captcha in the frame, it is very hard to describe...

    so here is my test code, i have a complete code with multiple groups and players, but the test is easier to work with since its 1 group 1 player, here is code.

    <head>
    <title>Test Raid Page</title>
    <script language="JavaScript" type="text/javascript">
    <!--Begining of Java Script-
    function buildiframesA()
    {
    var rlink = prompt('Enter Raid ID:',"");
    var a = document.createElement("iframe");
    a.setAttribute("width","330");
    a.setPropertie("scrolling=no");
    a.setAttribute('***********', 'ifrm1');
    document.body.appendChild(a);
    a.setAttribute('src', "http://*****.******.com/joinraid.php?raidid=" + rlink + "*******************");
    }

    </script>




    <body>
    <a href="javascript:buildiframesA()">Group A</a>

    </body>
    </html>

    ok so now you guys can see the script, anything with *** i changed for privacy, what i am trying to do is remove the scroll bars, my second plan is to target/align the captcha in the iframe, as of now the captcha aligns but not 100% it aligns up to the part you type text into, i want it to align to the complete frame, if anyone can help i would much appreciate it.

    If you guys really want to help but don't understand i can take multiple screen shots i can also debug in my browser on my game if that helps at all.

    MrGato

  2. #2
    Join Date
    Apr 2003
    Location
    Netherlands
    Posts
    21,654
    Code:
    a.setAttribute("width","330px");
    a.setPropertie("scrolling=no"); // no such method
    a.setAttribute('***********', 'ifrm1'); // invalid attribute?
    my second plan is to target/align the captcha in the iframe
    If it's not in your domain, you can't do this.
    You could give the iframe a margin to shift it into position.

  3. #3
    Join Date
    Dec 2009
    Location
    NY
    Posts
    8

    Post

    hello and thanks for the help, i was able to fix my scrolling issue.

    a.setAttribute("scrolling=no");

    to

    a.setAttribute('scrolling','no');

    fixed it right up, now here is another thing, multiple frames open up, after i type in the captcha and press enter i want it to auto move to the next captcha/frame, i was told i need to make an event, but like i said i am new, and it took me many hours just to figure out my scrolling issue lol

    MrGato

  4. #4
    Join Date
    Dec 2009
    Location
    NY
    Posts
    8

    Wink

    for some reason it would not let me edit my above post.

    Im sure you are wondering what i am exactly scripting and i have taken a screen shot, it is basically perfect and 80&#37; complete.

    http://delusionow.freehostia.com/raids.jpg

    If you notice, the captchas are aligned in the iframe next to the imput box, i tried toe scrollto x y and found out i cant if i have scrolling disabled, i tried it with and without scrolling and no luck,

    There is 2 things i am missing to complete the script, 1 is alignment and 2 is an onkeyup event, what i want to do is after i type a captcha and press enter, apon the enter button being released i want it to move to the next frame/captcha input box, i would appreciate any help since i have spent the past 4 hours testing different codes.

    MrGato

  5. #5
    Join Date
    Apr 2003
    Location
    Netherlands
    Posts
    21,654
    Is the captcha also in your domain?

    The image link does not work.

  6. #6
    Join Date
    Dec 2009
    Location
    NY
    Posts
    8

    Post

    hi, im sorry about that, the host that i use needs http:// in the beginning.

    http://delusionow.freehostia.com/raids.jpg

    The captchas are not on my site, this script is a remote script you open from your desktop or documents folder, and let sit in browser until a god spawns, when a god spawns i press a group, and im prompt to put the god ID in, from there the frames open and captchas align themselves to the input box. its purpose is to speed up the joining process of gods.

    i also thought about it and i would like to add a TAB to next frame event instead of onkeyup enter, since if the captcha is typed wrong it will just refresh and show another. with tab i can control when i want to go to next frame.

    MrGato

  7. #7
    Join Date
    Dec 2009
    Location
    NY
    Posts
    8

    Post

    Hello i am very sorry but my host is being stupid, i uploaded the pic to a new site.

    http://i49.tinypic.com/e155l0.jpg

    also

    a.setAttribute('***********', 'ifrm1'); // invalid attribute?



    *** was added for privacy since there was a players name in that field.

    now i believe i cant align the captchas since it is not part of my host, but is there a way around it where i can add a transparent filler on the left side to push the captcha more centered?

    also is there a way to make a event for on key down {TAB} move to next iframe, which would target the input box of the next captcha.

    MrGato

  8. #8
    Join Date
    Apr 2003
    Location
    Netherlands
    Posts
    21,654
    *** was added for privacy since there was a players name in that field.
    That makes it invalid

    Use a margin on the iframe to position it.

  9. #9
    Join Date
    Dec 2009
    Location
    NY
    Posts
    8

    Post

    Thanks for the help, i will try messing around with the margin.

    yes it is invalid because of *** but on my script there is a name there, i only put *** in place of it since i posted the code on the forums.

    MrGato

  10. #10
    Join Date
    Apr 2003
    Location
    Netherlands
    Posts
    21,654
    Quote Originally Posted by Mrgato View Post
    yes it is invalid because of *** but on my script there is a name there, i only put *** in place of it since i posted the code on the forums.
    It's invalid if it's not listed here: http://www.w3.org/TR/html401/index/attributes.html

  11. #11
    Join Date
    Dec 2009
    Location
    NY
    Posts
    8

    Post

    I would like to know if i have this right, when i debug i dont notice a difference, when i change the code the frame wont load.

    This code allows the frame to load but i dont notice any position difference, i have not fully tested it, but will do so tonight.

    a.setAttribute('marginwidth','5');


    I am trying to make everything into 1 document.

  12. #12
    Join Date
    Dec 2009
    Location
    NY
    Posts
    8

    Post

    Hello again, i still have not been able to fix my alignment issue, i have decided to move on, and i redisigned the whole thing using a dynamic drive slide menu, i scripted another Page, named SkillsPage.html, which also has a Dynamic Drive menu but with different groups, i was told from someone i will need to make a seprate css style sheet to possible align the captchas, so im guessing this will be one of the last things i do since i know its possible.

    When i get the chance tomorrow, and finish the basic layout, and most of the scripting i will take fresh new screen shots. This is my first javascript project.

    MrGato

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles