Html tag beginning with question mark?

被刻印的时光 ゝ 提交于 2021-02-16 20:35:16

问题


I'm learning google apps script, and in this tutorial, I saw some weird looking syntax: <? /* JS code */ ?> and <?= /* JS code */ ?>

<!DOCTYPE html>
<html>
  <head>
    <base target="_top">
    <title>Message Display Test</title>
    <link rel="stylesheet" href="https://ssl.gstatic.com/docs/script/css/add-ons1.css">
  </head>
  <body style="padding:3em;">
  <h1>Messages</h1>
    <ul>
    <? for(var m=0;m<messages.length;m++){ ?>
    <li><?= messages[m].getSubject() ?></li>
    <p><?= messages[m].getPlainBody() ?></p>
    <? } ?>
    </ul>
  </body>
</html>

I can kind of understand what is going on, but I'm still confused. I've never seen these while learning HTML. How does this compare to script tags?


回答1:


In Google Apps Script <? . . .?> are called standar scriptlets, <?= . . . ?> are printed scriptlets and <?!= . . . ?> are force printing scriplets. They are used in Google Apps Script HTML Service templated HTML.

Resource

  • https://developers.google.com/apps-script/guides/html/templates

Related

  • How to use scriptlets in HTMLOutput in Google Apps Script
  • What does <?!= mean in Google Apps Script?



回答2:


The question mark is used for PHP and is incorporated into html to work. It is another programming language related to web design. PHP is mainly used to make more advanced form system.



来源:https://stackoverflow.com/questions/63571391/html-tag-beginning-with-question-mark

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!