This is the code....
....
[HTML]<p>Some text outside the iframe.</p>
<iframe name="iframe1" id="iframe1" src="http://www.devittwinery.com/our_wines.html"></iframe>
<form>
<input type="text" name="textbox1" value="" />
<input onclick="copyit(this.form.textbox1)" type="button" value="Copy" name="btnCopy" />
</form>
[/HTML]....
and the javascript function is:
Expand|Select|Wrap|Line Numbers
- function copyit(theField) {
- var selectedText = document.selection;
- if (selectedText.type == 'Text') {
- var newRange = selectedText.createRange();
- theField.focus();
- theField.value = newRange.text;
- } else {
- alert('select a text in the page and then press this button');
- }
- }
Expand|Select|Wrap|Line Numbers
- iframe = document.getElementById("iframe1");
- var selectText =iframe.contentWindow.selection;
Can anyoane help me?... pls Thanks