HTML - Text Copy Script
Hi everyone. I have a script code that I'm trying to put on my photography site on MySpace. But everytime I do it takes away the script tags and turns everything simply into text instead of an HTML code. So it won't work. I was wondering if anyone could tell me how to fix this? I would be really greatfuly if you could. Thanks! Here's the code.
HTML Code: <script> //Copytext to clipboard- by Gennero (patrice.gennero@voila.fr) //Submited to DynamicDrive.com //Visit http://www.dynamicdrive.com for this script bBool=false var copiedtext="" var tempstore="" function initiatecopy() { bBool=true; } function copyit() { if (bBool) { tempstore=copiedtext document.execCommand("Copy") copiedtext=window.clipboardData.getData("Text"); if (tempstore!=copiedtext) { alert(copiedtext); } bBool=false; } } document.onselectionchange = initiatecopy document.onmouseup = copyit </script> --Jo Similar TutorialsHi I work at a helpdesk and we are creating a knowledge base of all of our information. We are currently trying to develop a way to track the steps that the agents have completed within the knowledge document. Therefore, someone brought up the bright idea that after each step or beside each step that there will be a check box. Once the agent clicks that check box the information from that step would be logged as a log comment within our ticketing system. Now we can move the data into the log comment field without a problem but we are running into the issue of copying the selected text with check box. Could anyone assist with the coding? Hey guys, im completely new to web development, as in, i've literally never tried it before so im hoping you guys can help me I have a local HTML and, basically, it has 2 text boxes and one button. now the button currently takes you to another page, but i want that button to copy the text from the second text box to my clipboard, so i can paste it into another document i have adobe dreamweaver cs5 but im willing to pick up any other software i might need to pull this off all help appreciated! Hi, this seems simple to me but i cant do it! the buttons do work but when i combine them on the same text area they dont work! heres what i have put together so far, Select all form: <form name="select_all"> <textarea name="text_area" rows="2" cols="80">TEXT TEXT TEXT TEXT</a> </textarea><br /> <input type="button" value="select all" onClick="javascript:this.form.text_area.focus();this.form.text_area.select();"> </form><br /> Copy Text area: <textarea cols=85 rows=20 id='testText'>TEXT TEXT TEXT TEXT</textarea><br> <button onclick='copyToClipboard(document.getElementById("testText").value);'>Copy To Clipboard</button> Copy javascript: <script type='text/javascript'> function copyToClipboard(s) { if( window.clipboardData && clipboardData.setData ) { clipboardData.setData("Text", s); } else { // You have to sign the code to enable this or allow the action in about:config by changing user_pref("signed.applets.codebase_principal_support", true); netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect'); var clip = Components.classes['@mozilla.org/widget/clipboard;[[[[1]]]]'].createInstance(Components.interfaces.nsIClipboard); if (!clip) return; // create a transferable var trans = Components.classes['@mozilla.org/widget/transferable;[[[[1]]]]'].createInstance(Components.interfaces.nsITransferable); if (!trans) return; // specify the data we wish to handle. Plaintext in this case. trans.addDataFlavor('text/unicode'); // To get the data from the transferable we need two new objects var str = new Object(); var len = new Object(); var str = Components.classes["@mozilla.org/supports-string;[[[[1]]]]"].createInstance(Components.interfaces.nsISupportsString); var copytext=meintext; str.data=copytext; trans.setTransferData("text/unicode",str,copytext.length*[[[[2]]]]); var clipid=Components.interfaces.nsIClipboard; if (!clip) return false; clip.setData(trans,null,clipid.kGlobalClipboard); } } </script> Any sugestions? My code: Code: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=windows-1250"> <meta name="generator" content="PSPad editor, www.pspad.com"> <title></title> </head> <body> <script type="text/javascript"> value1 = prompt("an article of clothing", ""); value2 = prompt("plural noun", ""); value3 = prompt("a kind of relative ", ""); value4 = prompt("an animal ", ""); value5 = prompt("a plural noun", ""); document.write("This tale is is about a girl called Little Red Riding Hood, after the red " + value1 + " she always wears. The girl walks through the woods to deliver " + value2 + " to her sick " + value3 + ". A " + value4 + " wants to eat the girl but is afraid to do so in public. He approaches the girl, and she naively tells him where she is going. He suggests the girl pick some flowers, which she does. In the meantime, he goes to the " + value3 + "'s house and gains entry by pretending to be the girl. He eats the " + value3 + ". When the girl arrives, he eats her whole too. A hunter, however, comes to the rescue and cuts the " + value4 + " open. Little Red Riding Hood and her " + value3 + " emerge unharmed. They fill the wolf's body with heavy " + value5 + ", which kill him.") </script> </body> </html> Thanks BillyGalbreath showed how to do it. Hi, I am basically a complete beginner when it comes to programming, but im trying to learn so I hope someone can help me. (This is an assignment from the university btw). If that matters in any way. I am making a website with different functions. One of them beeing a text box, where you can input a number. And a javascript will square the number for you. The textbox appears as normal on my website, and I think the javascript should be good, but obv if anything is wrong with it please feel free to comment. When I enter the number and press enter, the only thing appering is the raw code of the javascript. Nothing happens basically, so obv im wondering what I have done wrong. Hope someone can help me. So heres the html code: </div> <div id="content"> <fieldset> <legend>Oppgave 1</legend> <form method="get" action="kvadrering.jsp"> <p><input type="text" name="tall"> <input type ="submit" value="send"></p> </form> </fieldset> And heres the javascript: <form> <input type="text" id="input"></input> <script type="int/javascript"> function kvadrering() { var input = document.getElementById("tall").value; var resultat; resultat = Math.pow(input,2); document.write(resultat); } </script> </form> Hope someone can help me=) I was given some Java Script code to put in an HTML formatted file. The java script will randomly create an image. What I would like to do do is add text and make it so the text starts at the top of the image and not the bottom like it's doing now. In short, I'd like to have the text wrap around the image that the java script creates. Is this possible, and how do I do it? http://www.gouramidesign.com/portfolio.aspx#webdesign See that website, how it opens a lightbox type of thing, but wth the image on the left side and then a text on the right side ?What scripts does that website use? I currenty use prettybox, a jquery script, but I dont want to JUST display images, io want to have a website portfolio and thi sis EXACTLY what I've been looking for! Ok, basically here is the run down of what I am looking for this script to do. Code: http://www.thisisjustanexamplesite.com/stats=XXXX-XXXX-XXXX (X's representing numbers) All I want is the webpage to just show a text field and a submit button. So when the user puts in the numbers in the text field and hits submit, it automatically will put the numbers he put into the text field on the end of that link mentioned above and then take them there. I'm thinking it should just be simple HTML but possbily PHP maybe, not sure. Any help would be appreciated! Hello again Can someone please help me with this, I need a button that when clicked will pull a password from somewhere hidden from view and allow the users to paste it in the relevant frame of my web page. can this be done without using a text area, or by using an external txt file. basically the password we all use is stored in an email and I don't want to have to open outlook each time I need to use it, but I don't really want it the password displayed on the page either. hope I made sense if not please feel free to shout random abuse at me. Is it possible to make a button that when clicked, copies text from a box. Instead of manually selecting the contents and then copying with something like control+c. I don't know if this is possible with html alone, could anyone help? Hello all, im still very new to HMTL and this whole site design. there is a website that i would like to base mine on, its very simple HTML and the question i have is... Is it cheeky to copy the page source and say i did could i get into trouble if found out? Also here is the site in question... http://www.ne1co.info/about/index.html Thanks Hi, I have a requirment in my project wherein I have to read contents from another webpage hosted remotely, All I understand is that "View source" is one option, but how do I copy automatically the contents of the remote web page lets say for ex: "content" type data into my webpage Copying and pasting content manually is not allowed. And dont worry about the copyright stuffs. Its just for internal use. Thanks, Jay My webmaster is on vacation and I am trying to post a News Release on our website. This is a very basis question: The copy on this page is centered, and I want to align it left. Here's the page: http://www.247-direct-mail-services.com/news/ Seems to me, this is the style sheet html for this page: <p style="font-family:Arial, Helvetica, sans-serif; font-size:16px; font-weight:bold; text-align:left; color:#ffffff;"> But it's not showing this font nor aligning left. I don't know how to fix this. Hoping to get input. Thx. Hey everybody, I'd like to make a website based on an existing one: www.wiskundeclub.com. However, if I download the website using a program such as Backstreet Browser or HTTrack and then double-click on the "index.html" in the generated folder, I don't see the same thing as on www.wiskundeclub.com. Specifically, the animations don't seem to work; for the version downloaded with HTTrack I only see the initial white page with "Loading...". Does anybody know the reason for this? Thanks. Cheers, Kurt I have a wysiwyg text editor on my site and I want users to be able to copy-n-paste clip art from their ms word docs into it and have it display on the web. Is there anyway to do that? I am making a website and need to display some web content in several dozen parts of the page. The web content is made up of php scripts, and I don't really want to have to make copies of it all over the place, so I was hoping to use frames. A simplified example of what I want to do is this: I have a website at example.com, now I have a subdomain at a.example.com. I want a.example.com to look exactly the same as example.com (I want to be able to navigate through a.example.com exactly the same way I would through example.com). None of my links are absolute (ie. they're all /this/is/a/subdir), so I assume this is possible. Can someone point me in the right direction here please? I'm not new to html or php but have never used frames before. Hi! I need help! How can I copy a html table row when updated? The table is not in my site! I know the name and where it is! I prefer not to copy data manualy because it's not updated reguraly and I've not so much time! If I can automaticaly insert it in a mysql database is perfect!!! Can someone help me?!? Thanks! Hello I put up a static background portal page which has links to everything for the business and our email address. since the email address is static to the image, i want to make an image map and have that copy the email address to the clipboard and inform the user that it has been copies and can be pasted in their email client. How would i go about this? Thanks Hello, First off let me say thanks for checking this posting out. I am sort of stumped on this one however. My question is I have an inline frame that is holding data from a txt file. What I would like to do is take the data the inline frame is displaying and copy it to the clipboard using a button. Below are links to the images and the code I am using... Bascially you see the copy button, I want to click that and it copy the text thats in the inline frame to the clipboard so I can paste it elsewhere, like in word (just an example) Code: <html> <head> <title>SCWC Responces</title> <style> body { margin: 20px; background: #eee; } iframe { width: 700px; height: 300px; border: 1px solid #ccc; background: #fff; } </style> <script language="JavaScript"> <!-- function FP_swapImg() {//v1.0 var doc=document,args=arguments,elm,n; doc.$imgSwaps=new Array(); for(n=2; n<args.length; n+=2) { elm=FP_getObjectByID(args[n]); if(elm) { doc.$imgSwaps[doc.$imgSwaps.length]=elm; elm.$src=elm.src; elm.src=args[n+1]; } } } function FP_preloadImgs() {//v1.0 var d=document,a=arguments; if(!d.FP_imgs) d.FP_imgs=new Array(); for(var i=0; i<a.length; i++) { d.FP_imgs[i]=new Image; d.FP_imgs[i].src=a[i]; } } function FP_getObjectByID(id,o) {//v1.0 var c,el,els,f,m,n; if(!o)o=document; if(o.getElementById) el=o.getElementById(id); else if(o.layers) c=o.layers; else if(o.all) el=o.all[id]; if(el) return el; if(o.id==id || o.name==id) return o; if(o.childNodes) c=o.childNodes; if(c) for(n=0; n<c.length; n++) { el=FP_getObjectByID(id,c[n]); if(el) return el; } f=o.forms; if(f) for(n=0; n<f.length; n++) { els=f[n].elements; for(m=0; m<els.length; m++){ el=FP_getObjectByID(id,els[n]); if(el) return el; } } return null; } // --> </script> </head> <body onload="FP_preloadImgs(/*url*/'button13.jpg',/*url*/'button14.jpg')"> <p align="left">Please Choose The Appropriate Response :</p> <ul> <li><a target="show_file" href="SCWC_NO_SUPPID.txt">No 5-Digit Supplier Code</a></li> <li><a href="NO_INVALID_SPONSOR.txt" target="show_file">Ticket Reject;Invalid Sponsor</a></li> <li><a href="2ND_LEVEL_SUBMISSION.txt" target="show_file">2nd Level General Responce</a></li> </ul> <iframe name="show_file" width="844" height="300"></iframe> <p> <img border="0" id="img1" src="button12.jpg" height="20" width="100" alt="Copy" onmouseover="FP_swapImg(1,0,/*id*/'img1',/*url*/'button13.jpg')" onmouseout="FP_swapImg(0,0,/*id*/'img1',/*url*/'button12.jpg')" onmousedown="FP_swapImg(1,0,/*id*/'img1',/*url*/'button14.jpg')" onmouseup="FP_swapImg(0,0,/*id*/'img1',/*url*/'button13.jpg')" fp-style="fp-btn: Brick Column 9" fp-title="Copy"></p> </body> </html> -WinUser2003 |