如何通过js或php更改类 [英] how to change class via js or php
问题描述
我有两个页面是test1.html和test2.html
on test1 .html包含代码>>
Quote:<!DOCTYPE html>
< html>
< head>
< script src =http://ajax.googleapis.com/ajax/libs/jquery/1.9。 1 / jquery.min.js>
< / script>
< script>
$(document).ready( function(){
$(#test)。click(function(){
$(p:last)。removeClass(intro)。 addClass(main);
});
});
< / script>
< style type =text / css>
.intro
{
颜色:红色;
}
.main
{
背景颜色:黄色;
}
< / style>
< / head>
< body>
< a href =test2.htmlid =test>转到下一个< / a>
< / body&g t;
< / html
并在test2.html>>
Quote:
Quote:<!DOCTYPE html>
< html>
< head>
< ; script src =http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js>
< / script>
< script>
$(document).ready(function(){
$(#test)。click(function(){
$(p:last)。removeClass(intro)。addClass(main);
});
} );
< / script>
< style type =text / css>
.intro
{
颜色:红色;
}
.main
{
background-color:yellow;
}
< / style>
< / head>
< body>
这是一个段落。
< / body>
< / html
现在,当我点击转到下一页然后页面将被重定向到test2.html
然后在test2.html页面介绍类重命名与主类(
(文件).ready(function(){
(#test ).click(function(){
(p:last)。removeClass(intro)。addClass(main);
});
});
< / script>
< style type =text / css> ;
.intro
{
颜色:红色;
}
。主要
{
背景颜色:黄色;
}
< / style>
< / head>
< body>
< a href =test2.htmlid =测试>转到下一个< / a>
< / body>
< / html
和on test2.html>>
Quote:< blockquote class =FQ>
Quote:<!DOCTYPE html>
< html>
< head> ;
< script src =http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js>
< / script>
< script>
i have two page on is test1.html and test2.html
on test1.html contain code >>
Quote:<!DOCTYPE html>
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js">
</script>
<script>
$(document).ready(function(){
$("#test").click(function(){
$("p:last").removeClass("intro").addClass("main");
});
});
</script>
<style type="text/css">
.intro
{
color:red;
}
.main
{
background-color:yellow;
}
</style>
</head>
<body>
<a href="test2.html" id="test">go to next</a>
</body>
</html
and on test2.html >>
Quote:Quote:<!DOCTYPE html>
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js">
</script>
<script>
$(document).ready(function(){
$("#test").click(function(){
$("p:last").removeClass("intro").addClass("main");
});
});
</script>
<style type="text/css">
.intro
{
color:red;
}
.main
{
background-color:yellow;
}
</style>
</head>
<body>
This is a paragraph.
</body>
</html
now when i click on go to next then page will be redirected to test2.html
then on test2.html page intro class rename with main class (
(document).ready(function(){
("#test").click(function(){
("p:last").removeClass("intro").addClass("main");
});
});
</script>
<style type="text/css">
.intro
{
color:red;
}
.main
{
background-color:yellow;
}
</style>
</head>
<body>
<a href="test2.html" id="test">go to next</a>
</body>
</html
and on test2.html >>
Quote:Quote:<!DOCTYPE html>
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js">
</script>
<script>
这篇关于如何通过js或php更改类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!