▼ 2012/10/08(月) Javascriptでフォームの内容を一行返す
【Mac・PC】
<!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=shift_jis" /> <title>無題ドキュメント</title> <script language="javascript"> function TransText(){ var textfield1 = document.form1.textfield1.value; var hoge = new Array(); hoge = textfield1.split("\n"); window.alert(hoge[1]); } </script> </head> <body> <form name="form1"> <textarea name="textfield1" rows="4"></textarea> <br /> <br /> <input type="button" value="実行" name="Submit" onclick="TransText()" /> <br /> <br /> <label>textfield2<br /> <textarea name="textfield2" rows="4"></textarea> </label> <br /> <br /> <br /> </form> </body>
- TB-URL http://t-plan.2-d.jp/2nd/blog/0442/tb/