setInterval does not work

SineCosine

I'm still looking for my Tangent
Reaction score
77
Until you try it. On more than one browser.
You caught me >.>
I'll take your advice xD
It's not failed so far <.<

Hmm..
Weird.

I can't do this:
Some_iFrame.style.top = 480;
Or this:
Some_iFrame.style.top = '480px';

It'll stay at zero.

Anyways, I tried appending a form I wanted submitted to the iframe.
Then, I appended the iframe to the document body.
Finally I submitted the form..

The whole page got changed ._.
Not the iframe.
The entire page that the iframe was appended in =x

Is that supposed to happen? =/

[EDIT]
However, if I do this:
01) Append iframe to web page
02) attachEvent to iframe
03) Set iframe src to google.com

Only the iframe navigates away.
I'm guessing I can't just submit a form and expect to not get navigated away =/

[EDIT=2]
I tried:
01) Append iframe to web page
02) attachEvent to iframe
03) Set iframe src to the 'cbox' I want to tag
04) When the page loads, attachEvent's onload fires and appends the form only then.
05) It then submits the form.

Same thing =/
Whole page navigates =x

[EDIT=3]
Umm..
If I wanna' get an Element by ID within an iframe..
How would I do it? o.0

whichIFrame.contentDocument . . . ???
Yea, I got stuck after figuring out that far =x

[EDIT=4]
I think I know why appending the form to the iframe failed.
I was doing it directly.

Some_iFrame.appendChild(some_Form);
That fails, I think.

[EDIT=5]
YESSAH!!!
I DID IT!!
WOOO!!!!

I can finally append a form to an iframe, submit it and not have the entire webpage change!
WOOO!!!!!

I LOVE MY LIFE!!
(But I cheated, I googled for the answer >.>)
The method is the most tiresome ever!
 

celerisk

When Zerg floweth, life is good
Reaction score
62
" The method is the most tiresome ever "

You mean it's more involved than setting a target on the form?
If yes, why not just post it?
 

SineCosine

I'm still looking for my Tangent
Reaction score
77
Hmm..
Okay.

I found this snippet which helped a lot ^^

Code:
            function IFrame(parentElement)
            {
               // Create the iframe which will be returned
               var iframe = document.createElement("iframe");

               // If no parent element is specified then use body as the parent element
               if(parentElement == null) {
                  parentElement = document.body;
               }
               // This is necessary in order to initialize the document inside the iframe
               parentElement.appendChild(iframe);

               // Initiate the iframe's document to null
               iframe.doc = null;

               // Depending on browser platform get the iframe's document, this is only
               // available if the iframe has already been appended to an element which
               // has been added to the document
               if(iframe.contentDocument) {
                  // Firefox, Opera
                  iframe.doc = iframe.contentDocument;
               } else if(iframe.contentWindow) {
                  // Internet Explorer
                  iframe.doc = iframe.contentWindow.document;
               } else if(iframe.document) {
                  // Others?
                  iframe.doc = iframe.document;
               }
               // If we did not succeed in finding the document then throw an exception
               if(iframe.doc == null) {
                  throw "Document not found, append the parent element to the DOM before creating the IFrame";
               }
               // Create the script inside the iframe's document which will call the
               iframe.doc.open();
               iframe.doc.close();

               // Return the iframe, now with an extra property iframe.doc containing the
               // iframe's document
               return iframe;
            }

To take advantage of it, I tried to create a window, iframe and form.
Then, I tried to append the form to the iframe and the iframe to the window, which was wrong for reasons unknown.

What I did after a while was..
Code:
function CreateAFormInAFrameInANewWindow () {
    var Window = window.open('about:blank');
    var Form = document.createElement('form');
    var Input = document.createElement('input');
    var Frame;

    Window.document.write('Hello! <div id="ThisIsWhereTheFrameWillAppear <.<"></div>');
    Frame = new IFrame(Window.document.getElementById('ThisIsWhereTheFrameWillAppear <.<');
    Frame.doc.write('<div id="This is where the form will be xD"></div>');

    Form.action = 'http://IloverRabidGorrilas/form=submit';
    Form.method = 'post';
    Input.type = 'text';
    Input.name = 'MyGorilla';
    Input.value = 'Gloria';
    Form.appendChild('Input');

    Frame.doc.getElementById('This is where the form will be xD').appendChild(Form);

    //I know I could have used variables for the divs, But I'm lazy
    //Then, what comes after is attaching that onload event like you did
    //And submitting the form and doing other stuff when the page has loaded =)
    //Also, I took the concept a bit further and put many iframes in one window. 
    //The result is less windows opening and closing and less lag =x

    
}
 

JerseyFoo

1/g = g-1
Reaction score
40
Haven't read the thread, however try using events correctly.

Code:
function addEvent(o, e, f){ if (o.addEventListener) o.addEventListener(e, f, false); else o.attachEvent('on'+e, f); }
function delEvent(o, e, f){ if (o.addEventListener) o.removeEventListener(e, f, false); else o.detachEvent('on'+e, f); }

Usage
Code:
addEvent(document.body, 'keypress', CHAR_KEY);

keypress may need to be used on window, and there are many inconsistencies between browsers on keyup, keydown, and keypress.

PROTIP; stop capitalizing your variables and using keywords for variable names. This will backfire eventually.

Code:
        <comment>NPC</comment>

        <comment>Menu</comment>
Just asking for trouble here, what happens if Internet Explorer 9 accidentally drops support for the comment tag because no one ever thinks about it? Why would you even keep your comments in element format? Do you think it's good syntax, because it surely is not.
 
General chit-chat
Help Users

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top