我是初学者!我需要这样的东西:
C:\MyHtmlPage.html "string_that_I_need_to_pass_to_the_javascript_code_inside_MyHtmlPage"
并将“string_that_I_need_to_pass_to_the_javascript_code_inside_MyHtmlPage”放入:
var externalstring
有类似的事情吗?谢谢!
编辑:
我找到了方法!在 DOS 命令行中,我写:
start firefox "file:///C:/MyHtmPage.html?externalstring=string_that_I_need_to_pass_to_the_javascript_code_inside_MyHtmlPage"
在javascript中我添加了这个(http://papermashup.com/read-url-get-variables-withjavascript/):
var externalstring = getUrlVars()["externalstring"];
alert(externalstring);
function getUrlVars() {
var vars = {};
var parts = window.location.href.replace(/[?&]+([^=&]+)=([^&]*)/gi,
function(m,key,value) {
vars[key] = value;
});
return vars;
}
谢谢大家的建议!=)