The Cache: Technology Expert's Forum
 
*
Welcome, Guest. Please login or register. September 16, 2019, 10:04:40 PM

Login with username, password and session length


Pages: [1]
  Print  
Author Topic: So here's what I want to do:  (Read 2688 times)
vsloathe
vim ftw!
Global Moderator
Lifer
*****
Offline Offline

Posts: 1669



View Profile
« on: November 14, 2007, 11:04:17 AM »

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?
Logged

hai
perkiset
Olde World Hacker
Administrator
Lifer
*****
Offline Offline

Posts: 10096



View Profile
« Reply #1 on: November 14, 2007, 05:27:52 PM »

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 Wink
</edit>
Logged

It is now believed, that after having lived in one compound with 3 wives and never leaving the house for 5 years, Bin Laden called the U.S. Navy Seals himself.
meme
n00b
*
Offline Offline

Posts: 6


View Profile
« Reply #2 on: November 30, 2007, 09:36:30 AM »

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.
Logged

No links in signatures please
perkiset
Olde World Hacker
Administrator
Lifer
*****
Offline Offline

Posts: 10096



View Profile
« Reply #3 on: November 30, 2007, 09:42:51 AM »

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.
Logged

It is now believed, that after having lived in one compound with 3 wives and never leaving the house for 5 years, Bin Laden called the U.S. Navy Seals himself.
meme
n00b
*
Offline Offline

Posts: 6


View Profile
« Reply #4 on: November 30, 2007, 09:54:13 AM »

Yeah that makes sense, scratch that idea.
Logged

No links in signatures please
Pages: [1]
  Print  
 
Jump to:  

Perkiset's Place Home   Best of The Cache   phpMyIDE: MySQL Stored Procedures, Functions & Triggers
Politics @ Perkiset's   Pinkhat's Perspective   
cache
mart
coder
programmers
ajax
php
javascript
Powered by MySQL Powered by PHP Powered by SMF 1.1.2 | SMF © 2006-2007, Simple Machines LLC
Seo4Smf v0.2 © Webmaster's Talks


Valid XHTML 1.0! Valid CSS!