クローム・ブラウザ、ずいぶん複雑で、重厚・・だなぁ。きたない、スクリプトだが、
~綺麗にすると、うごかなくなる。 ・・・だろう。読み込んだ、
a、テキストファイルは、消しても残る。
b、改行文字で、スプリットしても、空白も、消える。<空白インデントは残したい。
c、リスト番号は、コピーできない。
d、単語・キーワードはコピーして、辞書に作れそう
x、すごく、きたない。 ~綺麗にすると、うごかなくなる。 ・・・だろう。で、
<タグ>、 カッコを、?L ~ R? におきかえて、UP
クロームは、消したはずの、テキスト・ファイルが、復活してる。 読み込んだ、ら、、、
どこかに、残っているらしい。 複雑・重厚 、、、クロームのけんきゅうしてるひといます?
y、これで、一行、ID= で、操作できる。
Z, さて、つぎは、 キー、コマンド、 の、色分け、それも、 ダイナミックに、
注目の、とき、だけ、いろつけ、 ます、 >Winmain >ShowBox??
++++++++
?L!DOCTYPE htmlR?
?L!-- saved from url=(0218)file:///C:/Documents%20and%20Settings/Administrator/%E3%83%87%E3%82%B9%E3%82%AF%E3%83%88%E3%83%83%E3%83%97/Dv-js/0%E3%80%8101%E3%80%81js-%E8%AA%AD%E3%81%BF%E8%BE%BC%E3%81%BF%E3%80%81HTML%E4%BD%9C%E3%82%8A%E3%80%81.html --R?
?LhtmlR??LheadR??Lmeta http-equiv="Content-Type" content="text/html; charset=UTF-8"R?
?LtitleR?
/JS-F-読み込み、学習.html <これを、べーすに、
?L/titleR?
?L/headR?
?LbodyR?>/Dv-js/JS-Tx入力欄-学習-1.html?data=hhhhhhh
こっちは、バカチャット のように、受け渡し \\ てすと
13:30 2019/01/18
ターゲットで、Pタグに書き込む
JavaScript テキストエリアの値を取得/設定するサンプル | ITSakura
https://itsakura.com/js-textarea
++++++
?LbrR?
>http://7ujm.net/asp/javascript8.html ?LbrR?
○ 絶対位置と相対位置のレイアウト ?LbrR?
styleに指定することにより、絶対位置と相対位置でレイアウトすることができます。
?LbrR??LbrR?
右と上を絶対位置で座標を指定、これによりボタンが右上に配置される。?LbrR?
?Linput type="button" style="position: absolute; right: 0px; top: 0px"R?
?LbrR??LbrR?
?Ldiv class="allWrapper"R??LdivR? ?LbrR?
?LbrR?
?Ldiv id="プログラムbegin"R? ?LdivR?
?LbrR?
+++++ ?LbrR?
?LbrR??LbrR??LbrR?
?p id="span1"? 設定した値 id="span1" ? ?/p?
?LpR?設定した値 ?Lspan id="span1"R?zzzzPenguin?L/spanR??L/pR?
?Lform name="myform"R?
?Linput name="myfile" type="file"R??LbrR?
?Ltextarea id="RzBox" name="output" cols="50" rows="50" style="position: absolute; right: 0px; "R?// Main.cpp
#include "StdAfx.h"
#include "../../../Common/MyWindows.h"
#include "../../../Common/MyInitGuid.h"
#include "../../../Common/CommandLineParser.h"
#include "../../../Common/StringConvert.h"
#include "../../../Common/TextConfig.h"
#include "../../../Windows/DLL.h"
#include "../../../Windows/ErrorMsg.h"
#include "../../../Windows/FileDir.h"
#include "../../../Windows/FileFind.h"
#include "../../../Windows/FileIO.h"
#include "../../../Windows/FileName.h"
#include "../../../Windows/NtCheck.h"
#include "../../../Windows/ResourceString.h"
#include "../../UI/Explorer/MyMessages.h"
#include "ExtractEngine.h"
#include "../../../../C/DllSecur.h"
#include "resource.h"
using namespace NWindows;
using namespace NFile;
using namespace NDir;
HINSTANCE g_hInstance;
static CFSTR kTempDirPrefix = FTEXT("7zS");
#define _SHELL_EXECUTE
static bool ReadDataString(CFSTR fileName, LPCSTR startID,
LPCSTR endID, AString &stringResult)
{
stringResult.Empty();
NIO::CInFile inFile;
if (!inFile.Open(fileName))
return false;
const int kBufferSize = (1 << 12);
Byte buffer[kBufferSize];
int signatureStartSize = MyStringLen(startID);
int signatureEndSize = MyStringLen(endID);
UInt32 numBytesPrev = 0;
bool writeMode = false;
UInt64 posTotal = 0;
for (;;)
{
if (posTotal > (1 << 20))
return (stringResult.IsEmpty());
UInt32 numReadBytes = kBufferSize - numBytesPrev;
UInt32 processedSize;
if (!inFile.Read(buffer + numBytesPrev, numReadBytes, processedSize))
return false;
if (processedSize == 0)
return true;
UInt32 numBytesInBuffer = numBytesPrev + processedSize;
UInt32 pos = 0;
for (;;)
{
if (writeMode)
{
if (pos > numBytesInBuffer - signatureEndSize)
break;
if (memcmp(buffer + pos, endID, signatureEndSize) == 0)
return true;
char b = buffer[pos];
if (b == 0)
return false;
stringResult += b;
pos++;
}
else
{
if (pos > numBytesInBuffer - signatureStartSize)
break;
if (memcmp(buffer + pos, startID, signatureStartSize) == 0)
{
writeMode = true;
pos += signatureStartSize;
}
else
pos++;
}
}
numBytesPrev = numBytesInBuffer - pos;
posTotal += pos;
memmove(buffer, buffer + pos, numBytesPrev);
}
}
static char kStartID[] = { ',','!','@','I','n','s','t','a','l','l','@','!','U','T','F','-','8','!', 0 };
static char kEndID[] = { ',','!','@','I','n','s','t','a','l','l','E','n','d','@','!', 0 };
struct CInstallIDInit
{
CInstallIDInit()
{
kStartID[0] = ';';
kEndID[0] = ';';
};
} g_CInstallIDInit;
#define NT_CHECK_FAIL_ACTION ShowErrorMessage(L"Unsupported Windows version"); return 1;
static void ShowErrorMessageSpec(const UString &name)
{
UString message = NError::MyFormatMessage(::GetLastError());
int pos = message.Find(L"%1");
if (pos >= 0)
{
message.Delete(pos, 2);
message.Insert(pos, name);
}
ShowErrorMessage(NULL, message);
}
int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE /* hPrevInstance */,
#ifdef UNDER_CE
LPWSTR
#else
LPSTR
#endif
/* lpCmdLine */,int /* nCmdShow */)
{
g_hInstance = (HINSTANCE)hInstance;
NT_CHECK
#ifdef _WIN32
LoadSecurityDlls();
#endif
// InitCommonControls();
UString archiveName, switches;
#ifdef _SHELL_EXECUTE
UString executeFile, executeParameters;
#endif
NCommandLineParser::SplitCommandLine(GetCommandLineW(), archiveName, switches);
FString fullPath;
NDLL::MyGetModuleFileName(fullPath);
switches.Trim();
bool assumeYes = false;
if (switches.IsPrefixedBy_Ascii_NoCase("-y"))
{
assumeYes = true;
switches = switches.Ptr(2);
switches.Trim();
}
AString config;
if (!ReadDataString(fullPath, kStartID, kEndID, config))
{
if (!assumeYes)
ShowErrorMessage(L"Can't load config info");
return 1;
}
UString dirPrefix = L"." WSTRING_PATH_SEPARATOR;
UString appLaunched;
bool showProgress = true;
if (!config.IsEmpty())
{
CObjectVector<CTextConfigPair> pairs;
if (!GetTextConfig(config, pairs))
{
if (!assumeYes)
ShowErrorMessage(L"Config failed");
return 1;
}
UString friendlyName = GetTextConfigValue(pairs, L"Title");
UString installPrompt = GetTextConfigValue(pairs, L"BeginPrompt");
UString progress = GetTextConfigValue(pairs, L"Progress");
if (progress.IsEqualTo_Ascii_NoCase("no"))
showProgress = false;
int index = FindTextConfigItem(pairs, L"Directory");
if (index >= 0)
dirPrefix = pairs[index].String;
if (!installPrompt.IsEmpty() && !assumeYes)
{
if (MessageBoxW(0, installPrompt, friendlyName, MB_YESNO |
MB_ICONQUESTION) != IDYES)
return 0;
}
appLaunched = GetTextConfigValue(pairs, L"RunProgram");
#ifdef _SHELL_EXECUTE
executeFile = GetTextConfigValue(pairs, L"ExecuteFile");
executeParameters = GetTextConfigValue(pairs, L"ExecuteParameters");
#endif
}
CTempDir tempDir;
if (!tempDir.Create(kTempDirPrefix))
{
if (!assumeYes)
ShowErrorMessage(L"Can not create temp folder archive");
return 1;
}
CCodecs *codecs = new CCodecs;
CMyComPtr<IUnknown> compressCodecsInfo = codecs;
{
HRESULT result = codecs->Load();
if (result != S_OK)
{
ShowErrorMessage(L"Can not load codecs");
return 1;
}
}
const FString tempDirPath = tempDir.GetPath();
// tempDirPath = L"M:\\1\\"; // to test low disk space
{
bool isCorrupt = false;
UString errorMessage;
HRESULT result = ExtractArchive(codecs, fullPath, tempDirPath, showProgress,
isCorrupt, errorMessage);
if (result != S_OK)
{
if (!assumeYes)
{
if (result == S_FALSE || isCorrupt)
{
NWindows::MyLoadString(IDS_EXTRACTION_ERROR_MESSAGE, errorMessage);
result = E_FAIL;
}
if (result != E_ABORT)
{
if (errorMessage.IsEmpty())
errorMessage = NError::MyFormatMessage(result);
::MessageBoxW(0, errorMessage, NWindows::MyLoadString(IDS_EXTRACTION_ERROR_TITLE), MB_ICONERROR);
}
}
return 1;
}
}
#ifndef UNDER_CE
CCurrentDirRestorer currentDirRestorer;
if (!SetCurrentDir(tempDirPath))
return 1;
#endif
HANDLE hProcess = 0;
#ifdef _SHELL_EXECUTE
if (!executeFile.IsEmpty())
{
CSysString filePath = GetSystemString(executeFile);
SHELLEXECUTEINFO execInfo;
execInfo.cbSize = sizeof(execInfo);
execInfo.fMask = SEE_MASK_NOCLOSEPROCESS
#ifndef UNDER_CE
| SEE_MASK_FLAG_DDEWAIT
#endif
;
execInfo.hwnd = NULL;
execInfo.lpVerb = NULL;
execInfo.lpFile = filePath;
if (!switches.IsEmpty())
{
executeParameters.Add_Space_if_NotEmpty();
executeParameters += switches;
}
CSysString parametersSys = GetSystemString(executeParameters);
if (parametersSys.IsEmpty())
execInfo.lpParameters = NULL;
else
execInfo.lpParameters = parametersSys;
execInfo.lpDirectory = NULL;
execInfo.nShow = SW_SHOWNORMAL;
execInfo.hProcess = 0;
/* BOOL success = */ ::ShellExecuteEx(&execInfo);
UINT32 result = (UINT32)(UINT_PTR)execInfo.hInstApp;
if (result <= 32)
{
if (!assumeYes)
ShowErrorMessage(L"Can not open file");
return 1;
}
hProcess = execInfo.hProcess;
}
else
#endif
{
if (appLaunched.IsEmpty())
{
appLaunched = L"setup.exe";
if (!NFind::DoesFileExist(us2fs(appLaunched)))
{
if (!assumeYes)
ShowErrorMessage(L"Can not find setup.exe");
return 1;
}
}
{
FString s2 = tempDirPath;
NName::NormalizeDirPathPrefix(s2);
appLaunched.Replace(L"%%T" WSTRING_PATH_SEPARATOR, fs2us(s2));
}
UString appNameForError = appLaunched; // actually we need to rtemove parameters also
appLaunched.Replace(L"%%T", fs2us(tempDirPath));
if (!switches.IsEmpty())
{
appLaunched.Add_Space();
appLaunched += switches;
}
STARTUPINFO startupInfo;
startupInfo.cb = sizeof(startupInfo);
startupInfo.lpReserved = 0;
startupInfo.lpDesktop = 0;
startupInfo.lpTitle = 0;
startupInfo.dwFlags = 0;
startupInfo.cbReserved2 = 0;
startupInfo.lpReserved2 = 0;
PROCESS_INFORMATION processInformation;
CSysString appLaunchedSys = GetSystemString(dirPrefix + appLaunched);
BOOL createResult = CreateProcess(NULL, (LPTSTR)(LPCTSTR)appLaunchedSys,
NULL, NULL, FALSE, 0, NULL, NULL /*tempDir.GetPath() */,
&startupInfo, &processInformation);
if (createResult == 0)
{
if (!assumeYes)
{
// we print name of exe file, if error message is
// ERROR_BAD_EXE_FORMAT: "%1 is not a valid Win32 application".
ShowErrorMessageSpec(appNameForError);
}
return 1;
}
::CloseHandle(processInformation.hThread);
hProcess = processInformation.hProcess;
}
if (hProcess != 0)
{
WaitForSingleObject(hProcess, INFINITE);
::CloseHandle(hProcess);
}
return 0;
}
?L/textareaR?
?Linput type="button" value="ボタン1" onclick="clickBtn1()"R?
?Linput type="button" value="クリア" onclick="clickBtn2()"R?
?L/formR?
?LscriptR?
var form = document.forms.myform;
var reader = new FileReader();
// form.output.textContent = d1 ;
form.output.textContent = this ;
form.myfile.addEventListener( 'change', function(e) {
var result = e.target.files[0];
//FileReaderのインスタンスを作成する
// var reader = new FileReader();
//読み込んだファイルの中身を取得する
reader.readAsText( result );
//ファイルの中身を取得後に処理を行う
reader.addEventListener( 'load', function() {
//ファイルの中身をtextarea内に表示する
form.output.textContent = reader.result;
target = document.getElementById("output");
///target = document.getElementName("output");
/// target.innerHTML = "Penguin";
})
})
?L/scriptR?
\\
http://www.kogures.com/hitoshi/javascript/gaibu-file/index-ajax.html ?LbrR?
Ajaxによる外部ファイルの非同期読込 ?LbrR?
?LbrR?
?LbrR??LbrR?
設定した値
?Lp id="span2"R? >>zzzzPenguin?L/pR?
?LscriptR?
const outputzzcn = document.myform.output;
//テキストエリアの、 なまえ、外で定数宣言
// 読み込みフォーム、名前、に、ついている
function clickBtn1(){ // func ボタン!
var data ="加工 >";
// alert("こんにちは" + data );
// alert("こんにちは");
////const textarea1 = document.myform.textarea1;
// const outputzzcn = document.myform.output;
// 値を設定
////textarea1.value = 100;
// outputzzcn.value = 100;
//document.myform.textarea1.value = 100;
// 値を取得
// outputzzcn.value=
// document.getElementById("span1").textContent = //textarea1.value;
// outputzzcn.value;
data = document.myform.output.value; //outputzzcn.value;
// alert("こんにちは" + data );
//data = data + element.value; //outputzzcn.value;
// alert("こんにちは" + data );
target = document.getElementById("span1");
target.innerHTML = "zzzzPenguin";
target = document.getElementById("span2");
//document.getElementById("span2").textContent = data ;
target.innerHTML = " R?R?" +data ;
}
function clickBtn2(){
//alert("こんにちは");
////document.myform.textarea1.value = ""; //クリア
////document.getElementById("span1").textContent = "";
document.myform.output.value = ""; //クリア
// document.getElementById("span1").textContent = "";
}
?L/scriptR?
?LbrR??LbrR?\\
+++++?LbrR?
https://www.ajaxtower.jp/ini/html/index1.html
?LbrR?
ファイルの中身をHTMLページ内の指定した位置に表示してみます。?LbrR?ここで、一行、読み込みしてみる?LbrR?
?LformR?
?Linput type="button" value="ファイル読み込み" onclick="loadText()"R?
?L/formR?
?Linput type="button" value="一行読み、" onclick="clickBtn3()"R?
?p id="span3"? ?/p?
?LpR?設定した値 ?Lspan id="span3"R??L/spanR??L/pR?
?LbrR?
?LbrR?
?L!--
?LpR?L1- ?Lspan id="L1"R??L/spanR??L/pR?
?LpR?L2- ?Lspan id="L2"R??L/spanR??L/pR?
?LpR?L3- ?Lspan id="L3"R??L/spanR??L/pR?
?LpR?L4- ?Lspan id="L4"R??L/spanR??L/pR?
?LpR?L5- ?Lspan id="L5"R??L/spanR??L/pR?
?LpR?L6- ?Lspan id="L6"R??L/spanR??L/pR?
?LpR?L7- ?Lspan id="L7"R??L/spanR??L/pR?
?LpR?L8- ?Lspan id="L8"R??L/spanR??L/pR?
--R?
?LscriptR?
function clickBtn3(){ // 一行 書き出す
//alert("こんにちは");
////document.myform.textarea1.value = ""; //クリア
////document.getElementById("span1").textContent = "";
// document.myform.output.value = ""; //クリア
// document.getElementById("span1").textContent = "";
// var text = document.getElementById("srcTextArea").value.replace(/\r\n|\r/g, "\n");
var text = document.getElementById("RzBox").value.replace(/\r\n|\r/g, '\n');
//
var lines = text.split( "\n" );
target = document.getElementById("span3");
// target.innerHTML = " txet ,, "; //data ;
// target.innerHTML = " txet ==R?" + lines +" ?LbrR??LbrR? NN"; //data ;
this.document.innerHTML = "L サイズ ==R?" + lines.length +" ?LbrR??LbrR? NN";
target = document.getElementById("L1"); // 4,
//var prime_minister_list = document.getElementById("prime_minister_list");
// L1 の、ID だから、L1で、いいはず。
var Pnum =0 ;
var IDname = "PgL", LIN="" ;
alert("アラート"+lines.length );
for ( var i = 0; i ?L lines.length; i++ ) {
LIN = IDname+ Pnum;
var zzL1 = document.createElement("li"); //1、
zzL1.setAttribute("id", LIN );
zzL1.innerHTML = lines[Pnum] ; // 3
Pnum++ ;
L1.appendChild(zzL1);
}
}
?L/scriptR?