faqts : Computers : Programming : Languages : JavaScript

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

16 of 22 people (73%) answered Yes
Recently 6 of 10 people (60%) answered Yes

Entry

Clipboard item is not there after a close a window that was created with open...write... IE only. Is there anything I can do ?

Apr 4th, 2008 19:31
ha mo, Colin Fraser, timur kiykioglu, http://www.codebits.com/bit.cfm?BitID=151


I got this code from http://www.codebits.com/bit.cfm?BitID=151 : 
Click on the first line of text in order to see that text pasted into
the third line of text:
<HEAD>
<SCRIPT>
function IsWhitespace(ch) {
	return(ch == ' ' || ch == '\n' || ch == '\r' || ch == '\t' || ch == '\f'
|| ch == '\v' || ch == '\b');
}
// SaveToClibboard
function S2CB() {
  maxLen = 80;
  numLines = event.srcElement.innerText.length / maxLen;
  newStr = '';
  startPos = 0;
  for (x = 0; x < numLines; x++) {
		endPos = startPos + maxLen;
		while (! IsWhitespace(event.srcElement.innerText.charAt(endPos)))
			endPos--;
		newStr = newStr + event.srcElement.innerText.substring(startPos, endPos) +
'\n';
		startPos = endPos + 1;
  }
  newStr = newStr + event.srcElement.innerText.substring(startPos,
event.srcElement.innerText.length) + '\n';
  window.clipboardData.setData('Text', newStr);
  oSource2.innerText = window.clipboardData.getData('Text');
}
</SCRIPT>
</HEAD>
<BODY>
<B ID="oSource" onClick="S2CB()">@changes 2000-Nov-01 DMM DMM00013
Silentsurf(nph-index.cgi,Interface.pm): Initial hits to the server are
immediately routed to the startup form which eliminates a lot of module
loading in the Silentsurf package./</B><br>
<B ID="oSource1" onClick="S2CB()">222</B><br>
<pre>!!<B ID="oSource2" onClick="S2CB()">333</B>!!</pre><br>
</BODY>
No guarantee of course, but it should work.
http://www.businessian.com
http://www.computerstan.com
http://www.financestan.com
http://www.healthstan.com
http://www.internetstan.com
http://www.moneyenews.com
http://www.technologystan.com
http://www.zobab.com
http://www.healthinhealth.com