谁能帮写一个点击链接自动弹出提示窗口的js代码?

来源:百度知道 编辑:UC知道 时间:2024/06/25 21:34:27
我想在 Discuz! 5.0.0论坛程序中加入一段js代码,让会员点击下载附件前自动弹出提示窗口,请问怎么写?

你需要修改attachment.php文件 在根目录下
在$attachexists = $ispaid = FALSE;下面添加
if (!empty($checktwo)) {

在最末尾的?>前添加
} else {
echo "<script>alert('写上你要提示的内容')</script>";
echo "<META HTTP-EQUIV=\"Refresh\" CONTENT=\"0;URL=$PHP_SELF?checktwo=1&aid=$aid\">";
}

我在本机架设Discuz! 5.0.1调试通过了

完整代码如下:
<?php

/*
[Discuz!] (C)2001-2006 Comsenz Inc.
This is NOT a freeware, use is subject to license terms

$RCSfile: attachment.php,v $
$Revision: 1.13 $
$Date: 2006/08/11 06:51:07 $
*/

require_once './include/common.inc.php';

$discuz_action = 14;

if($attachrefcheck && $_SERVER['HTTP_REFERER'] && preg_replace("/https?:\/\/([^\/]+).*/i", "\\1", $_SERVER['HTTP_REFERER']) != $_SERVER['HTTP_HOST']) {
//heade