html页面中的js代码
发布网友
发布时间:2022-04-21 07:14
我来回答
共1个回答
热心网友
时间:2022-04-21 08:44
var href = window.document.location.href
var html = '';
var matchDomain = 'http://www.abc.com/aaa/';
var domain = href.substr(0, matchDomain.length);
var isDefault = true;
if (domain == matchDomain) {
html = html+'<div class=\"divline\"></div><div class=\"c_left1\"><a href=\"http://www.abc.com\"><img src=\"1.gif\"></a></div>';
isDefault = false;
}
var matchDomain = 'http://bbs.abc.com/aaa/';
var domain = href.substr(0, matchDomain.length);
if (domain == matchDomain) {
html = html+'<div class=\"divline\"></div><div class=\"c_left1\"><a href=\"http://www.abc.com\"><img src=\"2.gif\"></a></div>';
isDefault = false;
}
var matchDomain = 'http://www.abc.com/bbb/';
var domain = href.substr(0, matchDomain.length);
if (domain == matchDomain) {
html = html+'<div class=\"divline\"></div><div class=\"c_left1\"><a href=\"http://www.abc.com\"><img src=\"3.gif\"></a></div>';
isDefault = false;
}
var matchDomain = 'http://bbs.abc.com/bbb/';
var domain = href.substr(0, matchDomain.length);
if (domain == matchDomain) {
html = html+'<div class=\"divline\"></div><div class=\"c_left1\"><a href=\"http://www.abc.com\"><img src=\"4.gif\"></a></div>';
isDefault = false;
}
if (isDefault)
html = html+ '<div class=\"divline\"></div><div class=\"c_left1\"><a href=\"http://www.abc.com\"><img src=\"5.jpg \"></a></div>';
document.writeln(html);
document.close();
isDefault为是否是默认的判断变量。