vsloathe

Supposing I have a browser object that I'm creating in a clientside language, like C# or whatever. Now, I can navigate the browser wherever, it looks like IE. I can also tell the browser what to add to the innerhtml of the page I'm displaying.

What I want to do here is add in some

javascript

  that will prevent anything aside from whatever is between the <form> tags from being displayed to the user.

Now, I don't want to obliterate everything else and take it off the page for fear of making the form not work, all I want to do is make sure I'm only showing the form to the user.

Anyone know a clever way to do this?

perkiset

Man that's a tricky one...

First blush: create a new div that is all white and covers the entire screen and is z-indexed at like 10000 to make sure it covers the entire screen (divA). Then create another div on top of that one (divB), then find the FORM node on the DOM and change it's parent to divB. This would do what you say ie., leave the entire page intact, but hidden behind your new stuff and the form drawn out in the "new front" of the page.

Never done anything like it, but there's not reason that I can see immediately that it couldn't be done.

<edit>
BTW - I can assist with the JS, but don't have time to just experiment with building that one for you mate Applause
</edit>

meme

Don't do it with z-index. Just select all children of <body>, set their css to display:hidden, then select all forms (or just the one you want) and set display:block (also the form's children).

Since you can do pretty much anything with said browser object, you could also load your target url in invisible iframe, grab the form and display it on your page, then trap the submit event on the cloned form and launch submit() on the iframe's form instead.

perkiset

Meme unless you're seeing something I'm not, in FF and Safari at least (haven't tried IE) the outside display:none overrides the inner display:block - just tested it again to make sure. The problem is, I believe, the way that the HTML parser works: I think that the display:none CSS effectively renders the inner contents of <that div or whatever> to something akin to "comment status" and the inner HTML of it therefore no longer matters.

meme

Yeah that makes sense, scratch that idea.


Perkiset's Place Home   Politics @ Perkiset's