howardfan123 Posted February 28, 2009 Share Posted February 28, 2009 can anyone tell me why this script is not working at allit is real basic one text box copys to two othe text boxes all on the same page <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /><title>Untitled Document</title><script language="JavaScript" type="text/javascript">function copyValue(el) { document.getElementById('copy_' + el.id).innerHTML = el.value; document.getElementById('copy2_' + el.id).innerHTML = el.value; }</script></head><style type="text/css">.title {font-family:"Comic Sans MS";}#cardone {border:#000000;border-width:medium;border-style:dashed;}#cardtwo {border:#FF00CC;border-width:medium;border-style:dashed;}</style><body><form><p><font class="title">my name is</font> <input name="mastername" type="text" id="mastername" value="" size="12" maxlength="12" onchange="copyvalue(this);"/></p><p> </p></form><div id="cardone"><p><input name="name2" type="text" disabled id="copy_mastername" readonly="true" /></p></div><div id="cardtwo"><p><input name="name1" type="text" disabled id="copy2_mastername" readonly="true" /></p></div></body></html> Link to comment Share on other sites More sharing options...
Technage Posted February 28, 2009 Share Posted February 28, 2009 Input textboxes do not have an innerHTML attribute change it to this and it will work. function copyValue(el) { document.getElementById('copy_' + el.id).value = el.value; document.getElementById('copy2_' + el.id).value = el.value; } Link to comment Share on other sites More sharing options...
howardfan123 Posted March 1, 2009 Author Share Posted March 1, 2009 WORKED PERFECT THANK YOU do you know how i can get just the cards to print without anything else Link to comment Share on other sites More sharing options...
howardfan123 Posted March 2, 2009 Author Share Posted March 2, 2009 Input textboxes do not have an innerHTML attribute change it to this and it will work.function copyValue(el) { document.getElementById('copy_' + el.id).value = el.value; document.getElementById('copy2_' + el.id).value = el.value; } thank you worker greatdo you by any chance know how i can get the cards to print and nothing else Link to comment Share on other sites More sharing options...
Synook Posted March 2, 2009 Share Posted March 2, 2009 You can dynamically create a new window with the card's contents and call print() on that. card = window.open();card.document.write(document.getElementById("copy_" + el.id).value);card.print();card.close(); Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.