【问题标题】:Javascript Code to include an image in a search result在搜索结果中包含图像的 Javascript 代码
【发布时间】:2020-05-24 09:36:10
【问题描述】:

我正在尝试在一个可以很好地显示相关搜索结果的容器中在搜索结果旁边显示图像,但我认为用于显示该图像的基于 javascript 的搜索引擎代码有问题,请帮助。

var tipuesearch = {
  "pages": [
    {
      "title": "Flash",
      "image": "C:Users/user/Documents/pages/Images/Flash.jpg",
      "text": "The Flash is a trilling science fiction movie, based on Barry Allen",
      "url": "C:/Users/user/documents/resizable/Flash.html"
    }, 
  ]
};

【问题讨论】:

    标签: javascript html css search


    【解决方案1】:

    要访问您的图片和网址,您需要:

    1. fs npm 包(通过服务器端的 Node.js 或客户端的 Webpack 提供)
    2. 使用本地网络服务器(如 WAMP、XAMPP)并相应地更改文件
    
    var tipuesearch = {
      pages: [
        {
          title: 'Flash',
          image: 'http://localhost:8080/pages/Images/Flash.jpg',
          text:
            'The Flash is a trilling science fiction movie, based on Barry Allen',
          url: 'http://localhost:8080/resizable/Flash.html'
        }
      ]
    };
    
    

    【讨论】:

    • 很高兴回答,我留下了一个赞成票,我希望在 Stack Overflow 上见到你很多。祝你好运
    • 让我尝试使用本地服务器,看看它是否可以工作
    • 将代码从双引号更改为单引号会影响更改吗?
    • 对标题样式有任何信息以使其看起来更吸引人吗?我知道这是高级网页设计
    猜你喜欢
    • 2016-09-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-01-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多