我有这个JavaScript。在jquery移动。我希望它只显示在这个div里面。现在,当我运行它时,它不会显示任何样式或jquery。只显示javascript。
<%@ Page Title="" Language="VB" MasterPageFile="~/MasterPage.master" AutoEventWireup="false"
CodeFile="phonedirectory.aspx.vb" Inherits="phonedirectory" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
<meta name="viewport" content="width=device-width, initial-scale=1">
<div class="timeline" id="lists" data-role="content">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
<div data-role="page">
<div data-role="header" data-theme="c">
<center>
<a href="Default.aspx">
<img src="Content/images/logo.png" /></a></center>
</div>
<script language="javascript" type="text/javascript">
if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp = new XMLHttpRequest();
}
else {// code for IE6, IE5
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.read
xmlhttp.open("GET", "xml.aspx", false);
xmlhttp.send();
xmlDoc = xmlhttp.responseXML;
document.write("<ul id='employee' data-role='listview' data-filter='true'>");
var x = xmlDoc.getElementsByTagName("employee");
for (i = 0; i < x.length; i++) {
document.write("<li class='ui-screen-hidden'>")
document.write("<a href='info.aspx?ID=");
document.write(x[i].getElementsByTagName("ID")[0].childNodes[0].nodeValue);
document.write("'>")
document.write(x[i].getElementsByTagName("Name")[0].childNodes[0].nodeValue);
document.write("</a></li>");
}
document.write("</ul>");
</script>
</div>
答案 0 :(得分:0)
首先,您不要关闭脚本标记。
其次,如果您在HTML页面中编写JavaScript,则应使用单引号以避免与用于HTML标记的双引号冲突,或者转义双引号。