小编Arc*_*nyx的帖子

PHP Jquery:将HTML转换为来自给定URL的JSON,并创建html元素的树视图

基本上我有一个文本框,我将输入URL并单击"确定按钮",它将在页面左侧显示HTML的预览; 并且右侧将具有HTML标记(正文,标题,div,span等)的树视图,在HTML中用作附加图像.预期的JSON结果应该是这个问题的结尾.我无法遍历JSON并创建树.我尝试了以下方法:

HTML和JS代码:

<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>ABC</title>
<link rel="stylesheet" type="text/css" href="css/main.css" />
</head>
<body>
<div id="wrapper">
    <header>
        <h1 class="logo"><img src="images/logo.png" alt="" title="" /></h1>
    </header>
    <div id="container">
        <div class="search-box">
            <input type="text" id="url" value="" class="txt-box" />
            <input type="button" value="OK" class="btn-search" />
        </div>
        <div class="inner-wrap">
            <div class="left-wrap" id="preview-sec">

            </div>
            <div class="right-wrap" id="tree-sec">

            </div>
        </div>
    </div>    
</div>

<script type="text/javascript" language="javascript" src="js/jquery-1.11.1.js"></script><!-- Jquery plugin -->
<script>
var counter = 0;
$(document).ready(function(){
    $('.btn-search').click(function(){
        if ($('#url').val() != '') {
            $.get(
                'http://localhost/test/getHTML.php', {url:$('#url').val()}, …
Run Code Online (Sandbox Code Playgroud)

html javascript php jquery json

27
推荐指数
1
解决办法
4858
查看次数

为什么我的Material AngularJS(CSS)在提供的演示中不起作用?

我是AngularJS世界的新手.但是,我希望实现AngularJS材料设计版本来创建表单.

所以我按照入门指示并尝试做某事,但它看起来不像网站上的那个.所以,我从Codepen复制了一个基本的演示

我想我已经添加了所有必要的文件.但是我仍然无法在Codepen上看起来像那样.我很确定它有一些CSS问题,但我无法指出它.

以下是我的代码:

angular
  .module('MyApp')
  .controller('DemoCtrl', function($scope) {
    $scope.user = {
      title: 'Developer',
      email: 'ipsum@lorem.com',
      firstName: '',
      lastName: '',
      company: 'Google',
      address: '1600 Amphitheatre Pkwy',
      city: 'Mountain View',
      state: 'CA',
      biography: 'Loves kittens, snowboarding, and can type at 130 WPM.\n\nAnd rumor has it she bouldered up Castle Craig!',
      postalCode: '94043'
    };
  })
  .config(function($mdThemingProvider) {

    // Configure a dark theme with primary foreground yellow

    $mdThemingProvider.theme('docs-dark', 'default')
      .primaryPalette('yellow')
      .dark();

  });
Run Code Online (Sandbox Code Playgroud)
<link rel="stylesheet" href="https://cdn.rawgit.com/angular/bower-material/v0.9.7/angular-material.css">
<script …
Run Code Online (Sandbox Code Playgroud)

html css angularjs material-design angular-material

1
推荐指数
1
解决办法
9140
查看次数