我正在尝试学习Javascript并决定自己尝试这个innerHTML属性.但浏览器似乎忽略了Javascript代码.我究竟做错了什么?
<!DOCTYPE html>
<html>
<head>
<title>JavaScript - Document Object Model </title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body>
<div id="page">
<h1 id="header">List</h1>
<h2>Buy groceries</h2>
<ul id="todo">
<li id="one" class="hot"><em>fresh</em> figs</li>
<li id="two" class="hot">pine nuts</li><li id="three" class="hot">honey</li>
<li id="four">balsamic vinegar</li>
</ul>
</div>
<script type="text/javascript">
var thirdItem = getElementById('three');
var itemContent = thirdItem.innerHTML;
thirdItem.innerHTML = '<li id="three" class="hot">chicken</li>';
</script>
</body>
</html>
Run Code Online (Sandbox Code Playgroud) 我正在尝试创建一个具有TextCell和SwitchCell元素的ViewCell.
这是我的代码 -
<ListView x:Name="AlarmList" HasUnevenRows="True" >
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<StackLayout Orientation="Horizontal">
<TextCell TextColor="#CCCCCC" Text="{Binding Name}" DetailColor="Red" Detail="{Binding Address}"></TextCell>
<SwitchCell />
</StackLayout>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
Run Code Online (Sandbox Code Playgroud)
我得到的错误是:
无法从'Xamarin.Forms.TextCell'转换为'Xamarin.Forms.View'
替代方案是使用这些
<Label ></Label>
<Switch ></Switch>
Run Code Online (Sandbox Code Playgroud)