0

guys i really need your help. im not sure how to even explain this so here goes.

i want to create a page where u enter a text and then u click a 'convert' button and the text is inserted to a larger text

for example lets say u enter 'john' into a field and then click 'convert'

it should now say 'my name is john, how are you?'

hope this makes sense.

2
Contributors
4
Replies
5
Views
8 Years
Discussion Span
Last Post by essential
0

Its really simple, converting textfield value and inserting it to your page. Ok il show how its done.

0

Here's a little working example, for this issue...

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<title>Convert Text</title>
<script type="text/javascript">
/* <![CDATA[ */
function convertTxt() {
if (document.forms['myForm']) {

var name = prompt('Please enter your name!','Demo'); 
 
var thisName = 'My Name is ' + (name.bold()).fontcolor('blue') + '!';
if ( document.all ) {
document.all['myName'].innerHTML = thisName; }
else if ( document.layer ) {
document.layers['myName'].innerHTML = thisName; }
else { document.getElementById('myName').innerHTML = thisName; }
}
}
/* ]]> */
</script>
</head>
<body>
<div>
<form action="javascript:void(0);" id="myForm">
<div>
<p id="myName">
</p>
<br />
<br />
<input type="button" value="convert" id="myButton" name="myButton" onclick="convertTxt()" />
</div>
</form>
</div> 
</body>
</html>
0

i keep getting an error everytime i try to delete the two option boxes on the right. everything else works perfect! but i cant seem to remove the options with it giving an error... HELP

<HTML><HEAD><TITLE>YouTube Code Convertor</TITLE>
<META http-equiv=Content-Type content="text/html; charset=windows-1252">
<META content= name=author>
<SCRIPT language=Javascript type=text/javascript><!--
//Youtube converter script
function convert()
{var truncurl;
var fv=""
var heig="344";
var wid="425";
var tubecode=document.ytc.user.value;
 var bp=tubecode.indexOf('youtube');
 var pointer="<br/><a href=\"http://360.yahoo.com\"><em>YouTube Convertor by ICE</em></a>";
 
var xf=tubecode.indexOf('http');
var xt=tubecode.indexOf('&');
var fvs=tubecode.slice(xt);
var xfe=fvs.indexOf('"');
fv=fvs.slice(1,xfe);
var chf=tubecode.indexOf('ght');
var cwf=tubecode.indexOf('dth');

heig=tubecode.slice((chf+5),(chf+8));
wid=tubecode.slice((cwf+5),(cwf+8));
if (document.ytc.autoplay.checked == true) {fv=fv+"&autoplay=1"};
if (document.ytc.bgsound.checked == true) {fv="autoplay=1";heig="1";wid="1";
pointer="<br/><a href=\"http://360.yahoo.com/\"><em>BackgroundSound<br>YouTube Convertor by ICE</em></a>";};
if (bp!=-1 && xf!=-1 && xt!=-1){
var truncurl=tubecode.slice(xf,xt);
document.getElementById('out').value="<center><embed src=" +truncurl+" width="+wid+" height="+heig+" type=application/x-shockwave-flash allowScriptAccess=\"none\" flashvars=\""+fv+"\"></embed>"+pointer+"</center>";}
else alert('Please enter a valid code'); 
}
--></SCRIPT>

<META content="Microsoft FrontPage 4.0" name=GENERATOR></HEAD>
<BODY text=#FFFFFF vLink=#800080 aLink=#ff0000 link=#0000ff bgColor=#000000><!-- topbanner -->
<TABLE height=20 width="100%" align=center bgColor=#000000 border=0>
  <TBODY>
  </TBODY></TABLE>
<CENTER>
<DIV align=center>
<TABLE cellSpacing=50 cellPadding=3 width="958">
  <TBODY>
  <TR>
    <TD width="734">
      <FORM name=ytc>
      <p>How to use:</p>
      <p>1. go to YouTube. select and copy an embed code</p>
      <p>2. right click in the box below and paste the code</p>
      <p>3. click convert</p>
      <p>4. click in the bottom box and then right click the highlighted code
      and copy</p>
      <p>5. go to you yahoo 360 and paste the code in html :)</p>
      <TABLE height="514">
        <TBODY>
        <TR>
          <TD height="273"><TEXTAREA name=user rows=11 cols=59 value="" overflow="auto"></TEXTAREA>
            <p><INPUT onclick=convert(); type=button value=convert> 
            </p>
          </TD>
          <TD height="273"><EM>Extra options:-</EM><BR><INPUT id=autoplay type= 
            name=autoplay>Auto Start This Video?<BR><INPUT id=bgsound 
            type= name=bgsound>Hide video and autoplay.(Background music option)<BR></FORM> 
            </FORM></TD></TR>
        <TR>
          <TD height="233"><TEXTAREA id=out onclick=this.select(); rows=11 readOnly cols=59 value="">Paste the entire Youtube code into the box above and click convert. Paste the code that appears here into your blog editor</TEXTAREA></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></DIV></CENTER></BODY></HTML>
0

Wel, All it needs is a clean code. Hope you enjoy this.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<meta http-equiv="Content-Style-Type" content="text/css" />
<title>YouTube Convertor</title>
<style type="text/css">
/* <![CDATA[ */
div {
   border: none;
   margin: 0;
   padding: 0; }

body {
   background-color: #000;
   border: none;
   color: #fff;
   font: normal 100%/90% Verdana, Arial, sans-serif;
   min-height: 600px;
   min-width: 800px;
   text-align: center; 
   width: auto; }


div#wrapper {
   margin: 0 auto;
   width: 95%; }

form {
   text-align: left;
   width: 100%; }

ol { 
   margin-left: 4%;
   text-align: left; }

caption {
   color: #eee;
   display: table-caption;
   margin-bottom: 1%;
   padding-left: .5em;
   text-align: left; }

table {
   margin: 0 auto;
   background-color: #222;
   border: thin solid #333;
   border-collapse: collapse;
   display: table;
   width: 70%; }
  
td { width: auto; padding: .3em; }

td.grouped { width: 20%;  padding: 2% 0% 2% 1%; }
/* ]]> */
</style>
<script type="text/javascript">
/* <![CDATA[ */

function convert() {
var tubecode = ( document.all ) ? (( document.forms['ytc'] ) || ( document.all['ytc'] )) : document.getElementById('ytc');

var heig = '344';
var wid = '425';
var bp = tubecode.user.value.indexOf('youtube');
var pointer = '<br /><a href="http://360.yahoo.com/"><em>YouTube Convertor By Ice</em></a>';

var xf = tubecode.user.value.indexOf('http');
var xt = tubecode.user.value.indexOf('&');
var fvs = tubecode.user.value.slice(xt);
var xfe = fvs.indexOf('\"');
var fv = fvs.slice(1,xfe);
var chf = tubecode.user.value.indexOf('ght');
var cwf = tubecode.user.value.indexOf('dth');
heig = tubecode.user.value.slice(((chf)+5),((chf)+8));
wid = tubecode.user.value.slice(((cwf)+5),((cwf)+8));

if ( tubecode.auto_play.checked ) { fv += ('&' +  tubecode.auto_play.value); }
if ( tubecode.bg_sound.checked ) { (( fv = tubecode.auto_play.value ) & ( heig = '1' ) & (wid = '1' )); pointer = '<br/><a href="http://360.yahoo.com/"><em>Background Sound<br />YouTube Convertor By ICE</em></a>'; }
if (( bp != -1 ) && ( xt != -1 ) && ( xf != -1 )) {
tubecode.out.readOnly = false;
var truncurl = tubecode.user.value.slice(xf,xt);
var content = '<center><embed src="' + truncurl + '" width="' + wid + '" height="' + heig + '" type="application/x-shockwave-flash allowScriptAccess="none" flashvars="' + fv + '">';
content += '</embed>' + pointer + '</center>'; 
tubecode.out.value = content; } else { alert('Please enter a valid code!'); }
}
/* ]]> */
</script>

</head>
<body>
<div id="wrapper">
<form id="ytc" action="#" onsubmit="return false;">
<table summary="YouTube Convertor">
<caption><strong><em>HOW TO USE?</em></strong></caption>
<tr>
<td colspan="3"><ol>
<li><p>go to YouTube. select and copy an embed code</p></li>
<li><p>right click in the box below and paste the code</p></li>
<li><p>click convert</p></li>
<li><p>click in the bottom box and then right click the highlighted code
and copy</p></li>
<li><p>go to you yahoo 360 and paste the code in html </p></li>
</ol>
</td>
</tr>
<tr>
<td colspan="3"><textarea id="user" name="user" rows="11" cols="59"></textarea></td>
</tr>
<tr>
<td colspan="3"><input type="button" value="convert" id="btn" name="btn" onclick="convert();" /></td></tr>
<tr><td colspan="3"><textarea id="out" name="out" rows="11" cols="59" readonly="readonly">Paste the entire Youtube code into the box above and click convert. Paste the code that appears here into your blog editor...</textarea></td>
</tr>
<tr>
<td><label><strong><em>Extra Options:</em></strong></label></td>
<td><label><input type="checkbox" id="auto_play" name="auto_play" value="autoplay=1" />&#32;Auto play start video?</label></td>
<td class="grouped"><label><input type="checkbox" id="bg_sound" name="bg_sound" value="bgsound" />&#32;Hide video and autoplay. (Background music option)</label></td>
</tr>
</table>
</form>
</div> <!-- #wrapper -->
</body>
</html>
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.