更改标题文本
Changing heading text?
我有这个代码:
HTML:
<button id='ro' class='ro'></button>
<button id='eng' class='eng'></button>
JAVASCRIPT:
$('#ro').click(function(){
$('h1').text('Bine aţi venit!');
$('p1').text('Pathifier îşi propune să ajute tinerii din întreaga ţară să işi găsească o facultate cu profilul dorit lăsându-le libertatea să-şi aleagă oraşul potrivit.');
alert('ma-ta');
});
$('#eng').click(function(){
$('h1').text('Welcome');
$('p1').text('Pathifier s goal is to help teens all around Romania to choose the university that fits them best, also allowing them to find the perfect city which has that university ');
});
这两个按钮是为了改变页面的语言,但我认为它们不起作用。为什么?我做错了什么?
我的javascript代码:
$(document).ready(function () {
//var cow = 'Check out this image <a href="http://link.com"><img src="http://image.com" style="border:2px solid #ccc;" /></a> and one with a width <a href="http://link.com"><img src="http://image.com" width="700" align="left" /></a>';
$('#ro').click(function(){
$('h1').text('Bine aţi venit!');
$('p').text('Pathifier îşi propune să ajute tinerii din întreaga ţară să işi găsească o facultate cu profilul dorit lăsându-le libertatea să-şi aleagă oraşul potrivit.');
alert('ma-ta');
});
$('#eng').click(function(){
$('h1').text('Welcome');
$('p').text('Pathifier s goal is to help teens all around Romania to choose the university that fits them best, also allowing them to find the perfect city which has that university ');
});
});
我的html:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="">
<title>One Page Wonder - Start Bootstrap Template</title>
<!-- Bootstrap Core CSS -->
<link href="css/bootstrap.min.css" rel="stylesheet">
<!-- Custom CSS -->
<link href="css/one-page-wonder.css" rel="stylesheet">
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
<script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
<link href='https://fonts.googleapis.com/css?family=Open+Sans:400,300,700' rel='stylesheet' type='text/css'>
</head>
<body>
<button id='ro' class='ro'></button>
<button id='eng' class='eng'></button>
<h1>KLJLKJ</h1>
<p>lkasjdflsj</p>
<h1>KLJLKJ</h1>
<p>lkasjdflsj</p>
<h1>KLJLKJ</h1>
<p>lkasjdflsj</p>
<!-- jQuery -->
<script src="js/jquery.js"></script>
<!-- Bootstrap Core JavaScript -->
<script src="js/bootstrap.min.js"></script>
<!-- my js -->
<script src="js/test.js"></script>
</body>
</html>
这是有效的。确保在jQuery之后包含jQuery和js文件。
相关文章:
- HighCharts长标题文本在某些元素上重叠
- 将超链接添加到“;标题“;标记文本
- 使用JavaScript将标题文本替换为按钮文本
- 更改标题文本
- 用Javascript替换图像和图像标题/alt文本
- 克隆元素时更改标题的文本
- 更改标题文本
- 为HTML文本区域设置标题属性的样式
- 使用 javascript 更改标题中的文本,例如幻灯片
- 从客户端(jQuery或JavaScript)设置ASPXGredView设置文本标题
- 在具有行标题和列标题的表中,给定列标题文本和单元格文本,如何选择单元格(td)
- 如何在鼠标悬停时动态向标题添加文本
- Javascript 打开一个新窗口并更改标题文本
- 在WordPress中使用标题文本设置花哨的框标题
- 有没有办法让标题中的文本等于
中定义的页面标题 - 如果我们在表格标题中有可编辑的文本,选项卡功能将无法正常工作
- 如何将剑道网格标题文本保持在顶部
- 逐行读取本地文本标题,将行存储在数组中
- JQuery-OnKeyPress输入文本标题大小写
- 将文本/标题添加到缩略图滑块