【发布时间】:2018-01-19 17:43:21
【问题描述】:
网站https://www.abeille-cyclotourisme.fr是手工制作的。不适用于 Wordpress 或任何 PHP 类型的数据库。
四天前,我在这个论坛上的“添加法律通知”主题上找到了非弹出式法律通知的解决方案。
较早的帖子:Add a legal notice to a website made of separate pages
我对脚本进行了转换,使法律声明将在单独的窗口中打开。
脚本,在根目录的“scripts”文件夹中,编写如下:
/* "Contactez nous"
Crée un message comportant l'adresse mail de l'abeille
et un texte dans le champ objet
*/
// Fonction htmlWindow_600
function htmlWindow_600(pagehtml) {
htmlWindow = window.open(pagehtml, "minifenetre", "toolbar=yes,status=yes,menubar=yes,location=yes,scrollbars=yes,resizable=yes,width=600,height=440")
htmlWindow.focus()
}
// Définition d'une variable contenant le début du code HTML
var liencontact="<a href='mailto:";
/* Ajout des différents éléments de l'adresse mail
dans la variable
*/
liencontact +="abeille-cyclotourisme";
liencontact +="@";
liencontact +="abeille-cyclotourisme.fr";
liencontact +="?subject=%5BAbeille%5D%20Demande%20d%27information'>";
// Affichage du lien vers "notice" et du lien mail
document.write("<a href='https://www.abeille-cyclotourisme.fr/notice.html' target='lien'>Notice<\/a> - "+liencontact+"Contactez-nous @<\/a>");
我希望它在比标准页面窄的弹出窗口中打开,这样访问者会立即*看到他在弹出窗口中。更窄?我为站点的所有弹出窗口选择了 600 像素的宽度:所有 html 弹出窗口都使用脚本 htmlwindow_600。
为什么是弹出窗口?因为法律通知是死胡同。没有链接从它开始,而我希望它可以从任何页面访问 - 更准确地说是从任何页面的页脚。把它变成一个普通的页面,就像我到目前为止所做的那样,看起来很奇怪,因为一旦你在法律通知上,你就想离开它。在我看来,关闭弹出窗口是最干净的解决方案,但其他人可能会反对。
顺便说一句:为什么要在自行车网站上发布法律声明?因为我们将开始收集我们组织的活动的预注册姓名,并相信我们必须 (1) 尊重我们的访客并 (2) 为自行车俱乐部和董事提供保护。
我已经用上面的脚本语言编写了 htmlWindow_600 脚本的语言,作为参考和方便我的测试,但没有成功使用它,或者任何其他打开更窄窗口的脚本。
我试过了:
document.write("<a href='https://www.abeille-cyclotourisme.fr/notice.html' target='lien' onclick='javascript:htmlWindow_600('https://www.abeille-cyclotourisme.fr/notice.html');return false'>Notice - <\/a>"+liencontact+"Contactez-nous @<\/a>");
使用标准 html,点击“通知”会打开一个新窗口,但无法使用函数 htmlWindow_600 打开弹出窗口。我怎么能治好这个? TIA
【问题讨论】:
-
弹出“法律通知”的目的是什么?
-
@mplungjan,您的意思是使用 AJAX 创建 XHR 请求以从文档本身获取 HTML 内容以将其呈现到对话框?
-
@Mr.Polywhirl 是的。一个 jQuery .load 类型的东西或在 iframe 中
标签: javascript html