Hi all,
I've got a sneeky problem to solve, I hope someone can help...
I've got a form (using just HTML and javascript), containing a couple of textfields. The goal is that a user just fills out the form-fields and hits the 'send'-button. Then the javascript combines the contents of the textfields with some prefab-pieces of HTML and the result is an HTML-code for a website containing the info that the user has filled out.....Are you still with me??
Now, my problem: sometimes a user might want to copy-and-paste a part of an existing website INTO one of the textfields (or: into the form) and see it in the resulting webpage (let's just say: I want to show a part of a webpage as evidence). When I use Internet Explorer and Outlook Express (or Frontpage), I just select the part of the website I want to re-use and paste it into the 'almost-ready-website' and Outlook Express shows it as a whole website (so does Frontpage).
But I want to do this in my webform: the user fills out the form and the user can copy-and-paste a part of an existing website into this form. And when he/she hits the 'SEND'-button, the HTML-code for the webpage AND the pasted webpage is generated!
I have no idea IF and when HOW I can do this! Does anybody have any experience with this? Any ideas?
I've got a feeling I'm turning around in circles here.....
Do I need ActiveX-components here? The result just needs to work in Explorer, so no other browser is concerned...
All help would be appreciated!! And any hint!
BTW: I don't want to make the user wander throught the source-code and select the html-code fromthere..
Thanx,
Derfel.
copy & paste a website into a form....
Moderator: General Moderators
- Derfel Cadarn
- Forum Contributor
- Posts: 193
- Joined: Thu Jul 17, 2003 12:02 pm
- Location: Berlin, Germany
- Derfel Cadarn
- Forum Contributor
- Posts: 193
- Joined: Thu Jul 17, 2003 12:02 pm
- Location: Berlin, Germany
- feyd
- Neighborhood Spidermoddy
- Posts: 31559
- Joined: Mon Mar 29, 2004 3:24 pm
- Location: Bothell, Washington, USA
If I understand right, you want a wysiwyg editor, that you can paste from an already existing page visually, rather than code based. This is doable. You'd have to write a COM compliant paste handler (that's how outlook and frontpage do it) ... Unfortunately, I don't think Javascript is at all COM compliant (exposed to the browser anyways). You'd require an ActiveX component, yes.
- Derfel Cadarn
- Forum Contributor
- Posts: 193
- Joined: Thu Jul 17, 2003 12:02 pm
- Location: Berlin, Germany
Thanx Feyd, for your reply!
I've got a piece of code, with which I can create a webpage in which someone can paste HTML-code. That code is then shown as a web-site (the HTML-result). Nothing I wrote, though
Do you know where I go from here?
I've got a piece of code, with which I can create a webpage in which someone can paste HTML-code. That code is then shown as a web-site (the HTML-result). Nothing I wrote, though
Code: Select all
<html>
<head>
<meta name="GENERATOR" Content="blabla">
<link
id="stylesheet"
rel="stylesheet"
href="../../Libraries/Css/Default.css">
<script
src="../../Libraries/UI/uiMenu.js"></script>
<script>
function uiHTMLConverter()
{
// init properties ***********************************************************
this.Target = document.getElementById('objHTMLConverter_Box')
this.Active = null
this.Command = 'Paste'
this.CommandBuffer = this.Target.createTextRange()
// init methodes ************************************************************
this.Reset = uiHTMLConverter_Reset
this.Convert = uiHTMLConverter_Convert
// start point **************************************************************
}
function uiHTMLConverter_Reset()
{
document.getElementById(objHTMLConverter_Box)
this.Active = null
}
function uiHTMLConverter_Convert()
{
if (!this.Active)
{
this.Target.select()
this.CommandBuffer.execCommand(this.Command)
this.Target.click()
}
}
</script>
<script for="window" event="onload">
objHTMLConverter = new uiHTMLConverter()
</script>
</head>
<body style="padding:2px; margin:0; background-color: transparent">
<div style="width:100%; height:100%" id="Container" onclick="objHTMLConverter.Convert()">
<textarea id="objHTMLConverter_Box" style="height:0px; width:0px" NAME="objHTMLConverter_Box" onclick="document.write(this.value)"></textarea>
</div>
</body>
</html>- Derfel Cadarn
- Forum Contributor
- Posts: 193
- Joined: Thu Jul 17, 2003 12:02 pm
- Location: Berlin, Germany
The above code works as follows: you can copy a piece of HTML-code with Ctrl-C and open the page containing the above code and then just left-click onto it. The result of the HTML-code is then shown.
I use it whenever I receive an e-mail in HTML-make-up: I Copy the entire HTML-mail and then click onto the page. As a result I then seen th e-mail as a 'normal' text, without HTML-make-up.
When you look in the source (after clicking onto the page), you don't get the HTML-source back, but just plain text.
You cannot select a part of a webpage and drag it onto the page and get the source-code, though. I think I would need something like that, but I'm not sure anymore how to approach my problem...
I use it whenever I receive an e-mail in HTML-make-up: I Copy the entire HTML-mail and then click onto the page. As a result I then seen th e-mail as a 'normal' text, without HTML-make-up.
When you look in the source (after clicking onto the page), you don't get the HTML-source back, but just plain text.
You cannot select a part of a webpage and drag it onto the page and get the source-code, though. I think I would need something like that, but I'm not sure anymore how to approach my problem...
- Derfel Cadarn
- Forum Contributor
- Posts: 193
- Joined: Thu Jul 17, 2003 12:02 pm
- Location: Berlin, Germany
Well, just to let you all know that my idea IS possible: I've found a solution! Some others have been struggling with the same and they've come up with two solutions: the first one is called Free Text Box and this one is an HTML editor control for ASP.NET and it's written in C#. So not quite what I was looking for.
But exact the thinmg I was looking for, I found as HTML-Area: a WYSIWYG-HTML-editor completely in HTML and Javascript. Exact what I wanted.
And completely FREE!
Perhaps someone else can use this too!
Thanx all!
But exact the thinmg I was looking for, I found as HTML-Area: a WYSIWYG-HTML-editor completely in HTML and Javascript. Exact what I wanted.
Perhaps someone else can use this too!
Thanx all!