|
Blue Forest http://www.lslnet.com at 8:28 on August 25, 2006
[Java] How to use Java to judge whether the current URL contains specific words to call the CSS words?
I encountered a problem :
Http://www2.italkbb.com/bb/cht/cht_index.asp, most pages on the web site are essentially static page (except includes the wording used ASP), there is no background.
But now my boss asked :
Click navigation into the relevant section (such help, there are many pages, but pages are named with all support), the navigation of the word "help" and other colors into the background.
It is similar to the logic :
[code]<a "%if Firstword=" B "then%>class=" 9zicu_huang "" %else%>class= "9zi_hui" "%end if%> style='mso-footnote-id:ftn1'" 03_guojifl.asp?firstword=B "" B</a>[/code]
But since they are static page is not impossible "%dim firstword. . . The endothelium. Therefore wanted to use Java to achieve.
If we can judge whether the current URL contains specific words (for example, support) to transfer CSS different words, it can become a reality.
PS : best simple sentences, and write in navigation :)
And the last question is actually very similar to the last question is not resolved :
Http://bbs.blueidea.com/viewthread.php?tid=2376650
I still know how to (sorry), but also Members of the season. |
I think you meant to use Javascript to replace the support Url values, and then call the css document?
Yes, I do have a solution :
[code]
"ID= link" skin "rel=" stylesheet "type=" text/css ""
"Script>
4003rd Url parameters of access
Function QueryString (item) (
Var sValue=location.search.match (new RegExp ( "[\?\&]" +item+ "= ([^\&]*) (\&?)", "i"))
Return sValue?sValue[1]:sValue
}
CssStyle = QueryString ( "support"));
Document.getElementById ( "skin"). Style='mso-footnote-id:ftn1' "css/" +cssStyle+. " Css ";
"/script>
[/code]
|
Dolphins : Thank you!
However, I do not want to transfer to another external css document. Css just want to use the current document, the only words another. For example, from a formal "aa" with the formal "bb." This is the case, how should write?
I am sorry that I was unfamiliar with Javascript, the heroes worry.
However, you can answer my code for the latter half of the other half hide :)
Http://bbs.blueidea.com/viewthread.php?tid=2390579 |
Oh, it's like, this should be writing bars below :
[code]
"Assume filled="f"" skin "," change style</div>
"Script>
4003rd Url parameters of access
Function QueryString (item) (
Var sValue=location.search.match (new RegExp ( "[\?\&]" +item+ "= ([^\&]*) (\&?)", "i"))
Return sValue?sValue[1]:sValue
}
CssStyle = QueryString ( "support"));
Document.getElementById ( "skin"). ClassName=cssStyle;
"/script>
[/code] |
Too thanks :)
Dolphins : DIV+CSS you are not very familiar?
This can help us to see :
[url=http://bbs.blueidea.com/viewthread.php?tid=2391819][color=#778899]http : //bbs.blueidea.com/viewthread.php?tid=2391819[/color]
If me. Mainnav li.selected attribute functioning, we can not trouble the Javascript.
I went to see my professor you :) |
Now you may wish to achieve the same results as bars, articles I have read, but they have more things to the station, I stopped analyzed. Bao won the Amoy Gardens to the previous analysis, the main codes are as follows :
[html]
"!DOCTYPE HTML PUBLIC" -//W3C//DTD HTML 4.01 Transitional//EN "
"Http://www.w3.org/TR/html4/loose.dtd" "
"Html xmlns=" http://www.w3.org/1999/xhtml ""
"Head are
"Meta http-equiv=" Content-Type "content=" text/html; charset=gb2312 "everywhere
"Title>xhtml first document</title>
"Style type=" text/css "media=" all ""
#Head Ul{
List-style-type:none;
}
#Head Ul{
Margin:0;
Padding:0;
}
#Head #ChannelMenuItems Li{
Float:left;
Height:30px;
Margin:0px 3px 0px 0px;
}
#Head #ChannelMenuItems --
Float:left;
Clear:right;
}
#Head #ChannelMenuItems A{
Display:block;
Float:left;
Height:30px;
Background:transparent government payments are capped (http://pics.taobao.com/2k5/sys/common/header/chl_home_left.gif) left top no-repeat;
Text-decoration:none;
}
#Head #ChannelMenuItems A span{
Display:block;
Float:left;
Height:30px;
Padding:9px 15px 0px;
Background:transparent government payments are capped (http://pics.taobao.com/2k5/sys/common/header/chl_home_right.gif) right top no-repeat;
Text-align:center;
Color:#000;
Font-style:normal;
Cursor:hand;
}
Body.CurHome ul#ChannelMenuItems li#MenuHome a{
Background:transparent government payments are capped (http://pics.taobao.com/2k5/sys/common/header/chl_home_left_act.gif) left top no-repeat;
}
Body.CurHome ul#ChannelMenuItems li#MenuHome a span{
Background:transparent government payments are capped (http : //pics.taobao.com/2k5/sys/common/header/chl_home_right_act.gif) no-repeat;font-weight:bold;color top right : #FFFFFF;
}
Body.CurCPanel ul#ChannelMenuItems li#MenuMy3A a{
Background:transparent government payments are capped (http : //pics.taobao.com/2k5/sys/common/header/chl_digital_left_act.gif) left top no-repeat;
}
Body.CurCPanel ul#ChannelMenuItems li#MenuMy3A a span{
Background:transparent government payments are capped (http : //pics.taobao.com/2k5/sys/common/header/chl_digital_right_act.gif) no-repeat;font-weight:bold;color top right : #FFFFFF;
}
Body.CurBuy ul#ChannelMenuItems li#MenuBuy a{
Background:transparent government payments are capped (http://pics.taobao.com/2k5/sys/common/header/chl_lady_left_act.gif) left top no-repeat;
}
Body.CurBuy ul#ChannelMenuItems li#MenuBuy a span{
Background:transparent government payments are capped (http : //pics.taobao.com/2k5/sys/common/header/chl_lady_right_act.gif) no-repeat;font-weight:bold;color top right : #FFFFFF;
}
Body.CurSell ul#ChannelMenuItems li#MenuSell a --
Background:transparent government payments are capped (http://pics.taobao.com/2k5/sys/common/header/chl_man_left_act.gif) left top no-repeat;
}
Body.CurSell ul#ChannelMenuItems li#MenuSell a span{
Background:transparent government payments are capped (http : //pics.taobao.com/2k5/sys/common/header/chl_man_right_act.gif) no-repeat;font-weight:bold;color top right : #FFFFFF;
}
Body.CurPowLev ul#ChannelMenuItems li#MenuPowerLevelling a --
Background:transparent government payments are capped (http://pics.taobao.com/2k5/sys/common/header/chl_life_left_act.gif) left top no-repeat;
}
Body.CurPowLev ul#ChannelMenuItems li#MenuPowerLevelling a span{
Background:transparent government payments are capped (http : //pics.taobao.com/2k5/sys/common/header/chl_life_right_act.gif) no-repeat;font-weight:bold;color top right : #FFFFFF;
}
Body.CurGReal ul#ChannelMenuItems li#MenuGameReal a --
Background:transparent government payments are capped (http : //pics.taobao.com/2k5/sys/common/header/chl_culture_left_act4.gif) left top no-repeat;
}
Body.CurGReal ul#ChannelMenuItems li#MenuGameReal a span{
Background:transparent government payments are capped (http : //pics.taobao.com/2k5/sys/common/header/chl_culture_right_act3.gif) no-repeat;font-weight:bold;color top right : #FFFFFF;
}
Body.CurForum ul#ChannelMenuItems li#MenuForum a --
Background:transparent government payments are capped (http : //pics.taobao.com/2k5/sys/common/header/chl_sports_left_act.gif) left top no-repeat;
}
Body.CurForum ul#ChannelMenuItems li#MenuForum a span{
Background:transparent government payments are capped (http : //pics.taobao.com/2k5/sys/common/header/chl_sports_right_act.gif) no-repeat;font-weight:bold;color top right : #FFFFFF;
}
/*-------------------- Hover trigger -----------------------------*/
#Head #ChannelMenuItems Li#MenuHome a:hover{
Background:transparent government payments are capped (http://pics.taobao.com/2k5/sys/common/header/chl_home_left_act.gif) left top no-repeat;
}
#Head #ChannelMenuItems Li#MenuHome a:hover span{
Background:transparent government payments are capped (http : //pics.taobao.com/2k5/sys/common/header/chl_home_right_act.gif) right top no-repeat;color:#FFFFFF;
}
#Head #ChannelMenuItems Li#MenuMy3A a:hover{
Background:transparent government payments are capped (http : //pics.taobao.com/2k5/sys/common/header/chl_digital_left_act.gif) left top no-repeat;
}
#Head #ChannelMenuItems Li#MenuMy3A a:hover span{
Background:transparent government payments are capped (http : //pics.taobao.com/2k5/sys/common/header/chl_digital_right_act.gif) right top no-repeat;color:#FFFFFF;
}
#Head #ChannelMenuItems Li#MenuBuy a:hover{
Background:transparent government payments are capped (http://pics.taobao.com/2k5/sys/common/header/chl_lady_left_act.gif) left top no-repeat;
}
#Head #ChannelMenuItems Li#MenuBuy a:hover span{
Background:transparent government payments are capped (http : //pics.taobao.com/2k5/sys/common/header/chl_lady_right_act.gif) right top no-repeat;color:#FFFFFF;
}
#Head #ChannelMenuItems Li#MenuSell a:hover{
Background:transparent government payments are capped (http://pics.taobao.com/2k5/sys/common/header/chl_man_left_act.gif) left top no-repeat;
}
#Head #ChannelMenuItems Li#MenuSell a:hover span{
Background:transparent government payments are capped (http : //pics.taobao.com/2k5/sys/common/header/chl_man_right_act.gif) right top no-repeat;color:#FFFFFF;
}
#Head #ChannelMenuItems Li#MenuPowerLevelling a:hover{
Background:transparent government payments are capped (http://pics.taobao.com/2k5/sys/common/header/chl_life_left_act.gif) left top no-repeat;
}
#Head #ChannelMenuItems Li#MenuPowerLevelling a:hover span{
Background:transparent government payments are capped (http : //pics.taobao.com/2k5/sys/common/header/chl_life_right_act.gif) right top no-repeat;color:#FFFFFF;
}
#Head #ChannelMenuItems Li#MenuGameReal a:hover{
Background:transparent government payments are capped (http : //pics.taobao.com/2k5/sys/common/header/chl_culture_left_act4.gif) left top no-repeat;
}
#Head #ChannelMenuItems Li#MenuGameReal a:hover span{
Background:transparent government payments are capped (http : //pics.taobao.com/2k5/sys/common/header/chl_culture_right_act3.gif) right top no-repeat;color:#FFFFFF;
}
#Head #ChannelMenuItems Li#MenuForum a:hover{
Background:transparent government payments are capped (http : //pics.taobao.com/2k5/sys/common/header/chl_sports_left_act.gif) left top no-repeat;
}
#Head #ChannelMenuItems Li#MenuForum a:hover span{
Background:transparent government payments are capped (http : //pics.taobao.com/2k5/sys/common/header/chl_sports_right_act.gif) right top no-repeat;color:#FFFFFF;
}
"/style>
"/head>
"Formal body" CurCPanel ""
"Assume filled="f"" Head, ""
"Assume filled="f"" ChannelMenu ""
"Ul filled="f"" ChannelMenuItems ""
"Li filled="f"" MenuHome "" <a style='mso-footnote-id:ftn1' "http://www.gameaaa.com/index.php?from=top" target= "_top", "front page <span>" /span></a></li>
"Li filled="f"" MenuMy3A "" <a style='mso-footnote-id:ftn1' "http://www.gameaaa.com/my3a.php?from=top" target= "_top" "I 3A</span></a></li> <span>
"Li filled="f"" MenuBuy "" <a style='mso-footnote-id:ftn1' "http://www.gameaaa.com/buy.php?from=top" target= "_top" "I want to buy <span>" /span></a></li>
"Li filled="f"" MenuSell "" <a style='mso-footnote-id:ftn1' "http://www.gameaaa.com/sell.php?from=top" target= "_top" "I sell <span>" /span></a></li>
"Li filled="f"" MenuPowerLevelling "" <a style='mso-footnote-id:ftn1' "http : //www.gameaaa.com/powlev.php?from=top "target=" _top "" <span> Dailian "/span></a></li>
"Li filled="f"" MenuGameReal "" <a style='mso-footnote-id:ftn1' "http://www.gameaaa.com/greal.php?from=top" target= "_top" /span></a></li> "<span> peripheral"
"Li filled="f"" MenuForum "" <a style='mso-footnote-id:ftn1' "http://www.gameaaa.com/forum.php?from=top" target= "_top" "<span> community" /span></a></li>
"/ul>
"/div>
"/div>
"/body>
"/html>
[/html]
If other pages, as long as the class can change the body, such as it is now : CurCPanel you try to look into the re-CurHome. |
Dolphins President, I started to see : the Amoy Po)
If you are still alive, help me look at a glance : This the bar where wrong (IE suggested cssStyle = QueryString ( "plans")); The trip began mistakes. This problem is my copy)
[html]
"Script>
4003rd Url parameters of access
Function QueryString (item) (
Var sValue=location.search.match (new RegExp ( "[\?\&]" +item+ "= ([^\&]*) (\&?)", "i"))
Return sValue?sValue[1]:sValue
}
CssStyle = QueryString ( "plans"));
Document.getElementById ( "ttpp"). ClassName= "navsele";
CssStyle = QueryString ( "features"));
Document.getElementById ( "ttff"). ClassName= "navsele";
CssStyle = QueryString ( "i"));
Document.getElementById ( "ttrr"). ClassName= "navsele";
CssStyle = QueryString ( "activation"));
Document.getElementById ( "ttac"). ClassName= "navsele";
CssStyle = QueryString ( "affiliate"));
Document.getElementById ( "ttaf"). ClassName= "navsele";
CssStyle = QueryString ( "support"));
Document.getElementById ( "tthh"). ClassName= "navsele";
CssStyle = QueryString ( "news"));
Document.getElementById ( "ttnn"). ClassName= "navsele";
"/script>
"Table
"Tr>
"Td bgcolor=" #3399CC ""
"A style='mso-footnote-id:ftn1'" enc_plans.asp "formal" text_10pt_bai "filled="f"" ttpp "and" services "</a>
"A style='mso-footnote-id:ftn1'" enc_features.asp "formal" text_10pt_bai "filled="f"" ttff "," functional products "</a>
"A style='mso-footnote-id:ftn1'" enc_rates.asp "formal" text_10pt_bai "filled="f"" ttrr "and" international rates "</a>
"A style='mso-footnote-id:ftn1'" enc_activation.asp "formal" text_10pt_bai "filled="f"" ttac "" activated accounts "</a>
"A style='mso-footnote-id:ftn1'" enc_affiliate.asp "formal" text_10pt_bai "filled="f"" ttaf "and" business "</a>
"A style='mso-footnote-id:ftn1'" enc_support.asp "formal" text_10pt_bai "filled="f"" tthh "and" help "</a>
"A style='mso-footnote-id:ftn1'" enc_news.asp "formal" text_10pt_bai "filled="f"" ttnn "," News "</a>
"=
"Per
"/table>[/html]
CSS : [code]
. Navsele{
Width:65px;
Text-decoration:none;
Font-weight:bold;
Background:#007fb7;
Color:#fff;
}
. Text_10pt_bai -- font-family : Verdana, Arial, Helvetica, sans-serif;font-size 10pt; color : : : #FFFFFF; text-decoration none;)
. Text_10pt_bai:link {color : #FFF; text-decoration none;) :
. Text_10pt_bai:visited {color : #FFF; text-decoration none;) :
. Text_10pt_bai:active {color : #FFF; text-decoration none;) :
. Text_10pt_bai:hover {color : #F0EFEC; text-decoration : underline;}[/code] |
[html]
"Script>
4003rd Url parameters of access
Function QueryString (item) (
Var sValue=location.search.match (new RegExp ( "[\?\&]" +item+ "= ([^\&]*) (\&?)", "i"));
Return sValue?sValue[1]:sValue;
}
CssStyle = QueryString ( "plans");
Document.getElementById ( "ttpp"). ClassName= "navsele";
CssStyle = QueryString ( "features");
Document.getElementById ( "ttff"). ClassName= "navsele";
CssStyle = QueryString ( "i");
Document.getElementById ( "ttrr"). ClassName= "navsele";
CssStyle = QueryString ( "activation");
Document.getElementById ( "ttac"). ClassName= "navsele";
CssStyle = QueryString ( "affiliate");
Document.getElementById ( "ttaf"). ClassName= "navsele";
CssStyle = QueryString ( "support");
Document.getElementById ( "tthh"). ClassName= "navsele";
CssStyle = QueryString ( "news");
Document.getElementById ( "ttnn"). ClassName= "navsele";
"/script>
"Table
"Tr>
"Td bgcolor=" #3399CC ""
"A style='mso-footnote-id:ftn1'" enc_plans.asp "formal" text_10pt_bai "filled="f"" ttpp "and" services "</a>
"A style='mso-footnote-id:ftn1'" enc_features.asp "formal" text_10pt_bai "filled="f"" ttff "," functional products "</a>
"A style='mso-footnote-id:ftn1'" enc_rates.asp "formal" text_10pt_bai "filled="f"" ttrr "and" international rates "</a>
"A style='mso-footnote-id:ftn1'" enc_activation.asp "formal" text_10pt_bai "filled="f"" ttac "" activated accounts "</a>
"A style='mso-footnote-id:ftn1'" enc_affiliate.asp "formal" text_10pt_bai "filled="f"" ttaf "and" business "</a>
"A style='mso-footnote-id:ftn1'" enc_support.asp "formal" text_10pt_bai "filled="f"" tthh "and" help "</a>
"A style='mso-footnote-id:ftn1'" enc_news.asp "formal" text_10pt_bai "filled="f"" ttnn "," News "</a>
"=
"Per
"ShapeID="_x0000_i1025" DrawAspect="Content" ObjectID="_1127825915"> </o:OLEObject>
[/html] |
Dolphin : you a lot of trouble, with nothing to report, you see a lot of integration on the portrait still did not apply, especially to do this simple icon, believing that Buchengjingyi :)
[img]http://www.olophone.com/img/dolphin_32-32.gif[/img]
I view it can be called reform, you're welcome. |
Haha, that good! ! ! Thank you! However, the application of the portrait is not so good. I wait for some more time to dwell on the earthen jar us! |
:)
You can look at the trouble again, the wrong pages also suggest :
[color=brown] 'Document.getElementById (. " . . ") 'Empty or not the target. [/color]
[url=http://www2.italkbb.com/bb/enc/enc_index.asp][color=#778899]http : //www2.italkbb.com/bb/enc/enc_index.asp[/color] point "News" should respond to a formal "navsele."
Is filled="f". " . . "Lane can write the link?
I for the "div><ul><li></li></ul></div>, wrote in the" li> Lane tried to suggest is still wrong.
Haha, the workers.
|
Sorry that I experience, I feel as if I see you here on the postings.
After learning to you.
Ah ah bother sorry, I can not hold back any longer and we have to stop. |
The above methods do not know where the problem in the server failures.
Lack of knowledge points for personal reasons could not be inspected. Test temporary stop.
CSS is the way to solve this case :
[url=http://bbs.blueidea.com/viewthread.php?tid=2400456][color=#778899]CSS Navigation of the Class Current response. Body patterns can write a page in columns ?[/color] Lane?
For those familiar with Java and Css you may only need to spend 10 minutes on it become clear to all. And I discovered, from busy this year, the problem is still there.
|
|