使用URL按“";接受;按钮(javascript)在调用网页时自动执行
我已经构建了一个javascipt代码,这是一个访问者必须接受的策略。 这是很好的工作,但现在我将使用一些系统帐户,他们不会接受自己的 现在我希望我能找到一个定制URL字符串的解决方案。我想创建一个“”字符串 我希望你能给我一个提示,我发现的只是“createButton” 代码如下:使用URL按“";接受;按钮(javascript)在调用网页时自动执行,javascript,html,url,Javascript,Html,Url,我已经构建了一个javascipt代码,这是一个访问者必须接受的策略。 这是很好的工作,但现在我将使用一些系统帐户,他们不会接受自己的 现在我希望我能找到一个定制URL字符串的解决方案。我想创建一个“”字符串 我希望你能给我一个提示,我发现的只是“createButton” 代码如下: 函数getConfirmation(){ var retVal=confirm(“您想通过接受策略继续吗?”); 如果(retVal==true){ document.write(“用户希望继续!”); /
函数getConfirmation(){
var retVal=confirm(“您想通过接受策略继续吗?”);
如果(retVal==true){
document.write(“用户希望继续!”);
//window.location=“URL”;
window.location=“URL”;
返回true;
}
否则{
document.write(“您尚未接受下载策略!”);
window.close();
返回false;
}
}
谢谢你,并致以最良好的祝愿,
Nils您可以使用
窗口.location.search
属性检查您的查询字符串参数是否存在,然后采取相应的操作。这样做是否能更好地满足您的需要
function continueOn() {
document.write("User wants to continue!");
window.location = "URL";
return true;
}
function getConfirmation() {
var retVal = confirm("Do you want to continue by accepting Policy ?");
if( retVal == true ){
return continueOn();
}
else{
document.write ("You have Not Accepted Download Policy!");
window.close();
return false;
}
}
function autoClickButton(queryString) {
if (queryString.indexOf('pressButtonAutomatically') > -1) {
return true;
}
else {
return false;
}
}
function init(queryString) {
if (autoClickButton(queryString)) {
continueOn();
}
else {
document.getElementById('button').addEventListener('click', getConfirmation);
}
}
init(window.location.search);
function continueOn() {
document.write("User wants to continue!");
window.location = "URL";
return true;
}
function getConfirmation() {
var retVal = confirm("Do you want to continue by accepting Policy ?");
if( retVal == true ){
return continueOn();
}
else{
document.write ("You have Not Accepted Download Policy!");
window.close();
return false;
}
}
function autoClickButton(queryString) {
if (queryString.indexOf('pressButtonAutomatically') > -1) {
return true;
}
else {
return false;
}
}
function init(queryString) {
if (autoClickButton(queryString)) {
continueOn();
}
else {
document.getElementById('button').addEventListener('click', getConfirmation);
}
}
init(window.location.search);