我無法通過下面的JavaScript函數在記事本中打開文本文件。如果你想幫忙,請運行這個自我解釋腳本。謝謝。無法通過JavaScript函數在記事本中打開文本文件
<script type="text/javascript">
function RunURL(URL,Name) {
window.open (URL,Name,
"Width=1010,\
Height=800,\
Top=0,\
Left=0,\
Channelmode=0,\
Titlebar=0,\
Menubar=0,\
Toolbar=0,\
Directories=0,\
Location=0,\
Status=0,\
Scrollbars=1,\
Resizable=1,\
Fullscreen=0");
}
</script>
可惜我不能張貼代碼在一塊...
<html><form>
<h2>Trying to open a text file in notepad for an Intranet app...</h2><br>
First the easy one...<br>
<input Type="button"; Value="Open Notepad"; OnClick="RunURL('file:///C:/Windows/system32/notepad.exe')";><br>
<br>Now to open a text file so let's start with some common sense for the parameters as displayed in the buttons...<br>
<input Type="button"; Value="?=C:\Test.txt"; OnClick="RunURL('file:///C:/Windows/system32/notepad.exe?=C:\Test.txt')";><br>
<input Type="button"; Value="?=file:///C:/Test.txt"; OnClick="RunURL('file:///C:/Windows/system32/notepad.exe?=file:///C:/Test.txt')";><br>
<input Type="button"; Value="?C:\Test.txt"; OnClick="RunURL('file:///C:/Windows/system32/notepad.exe?C:\Test.txt')";><br>
<br>Desperation takes over!<br>
<input Type="button"; Value="?open=file:///C:/Test.txt"; OnClick="RunURL('file:///C:/Windows/system32/notepad.exe?open=file:///C:/Test.txt')";><br>
<input Type="button"; Value="?open=C:\Test.txt"; OnClick="RunURL('file:///C:/Windows/system32/notepad.exe?open=C:\Test.txt')";><br>
<input Type="button"; Value="?open=C:/Test.txt"; OnClick="RunURL('file:///C:/Windows/system32/notepad.exe?open=C:/Test.txt')";><br>
<input Type="button"; Value="?C:/Test.txt"; OnClick="RunURL('file:///C:/Windows/system32/notepad.exe?C:/Test.txt')";><br>
<br>Could the file association alone trigger notepad to open it?<br>
<input Type="button"; Value="file:///C:/Test.txt"; OnClick="RunURL('file:///C:/Test.txt')";><br>
<input Type="button"; Value="C:/Test.txt"; OnClick="RunURL('C:/Test.txt')";><br>
<br>Nope!<br>
</form></html>
也許我應該回去做漢堡... :(
的多麼糟糕,這將是,如果有可能想的? 'nastysite.com?運行格式c:\'。 –
當您的內聯網上無法打開自己的文本文件時,甚至會更加恐怖! :) –
是否有你需要打開記事本實例的原因?記事本打開後你會發生什麼? – Ian