如何在Blogger中添加JavaScript?

[英]How can I add JavaScript inside Blogger?


I would like to add some JavaScript inside Blogger.

我想在Blogger中添加一些JavaScript。

<script type="text/javascript">
window.open("http://www.page.html", "myWindow", 
    "status = 1, height = 400, width = 400, resizable = 0");
</script>

If I edit the HTML and I add " and ' they get converted to quote ...

如果我编辑HTML并添加“和”它们会转换为引用...

If I add an HTML/JavaScript widget the code won't run.

如果我添加HTML / JavaScript小部件,代码将无法运行。

6 个解决方案

#1


17  

Navigate to the Layout tab, click the "Add a Page Element" option and select the "HTML/Javascript" sub-option.

导航到布局选项卡,单击“添加页面元素”选项,然后选择“HTML / Javascript”子选项。

See the Layout Guide for more details.

有关详细信息,请参阅布局指南。

#2


14  

Create a post. Click to enter html as opposed to compose. Type your script. To the right Click Post Settings >> Options >> Compose Mode then change Show HTML Literally to Interpret HTML. It should now accept your script as a script intsead of text..

创建一个帖子。单击以输入html而不是撰写。输入你的脚本。在右侧单击“发布设置”>>“选项”>>“撰写模式”,然后将“显示HTML字面”更改为“解释HTML”。它现在应该接受您的脚本作为脚本intsead文本..

#3


11  

Add your code like this:

像这样添加你的代码:

<script type='text/javascript'>
//<![CDATA[

window.open("http://www.page.html", "myWindow", 
    "status = 1, height = 400, width = 400, resizable = 0");

//]]>
</script>

#4


3  

You can run this code as an external source on your blog. How? follow below steps:

您可以在博客上将此代码作为外部源运行。怎么样?按照以下步骤:

Step 1: Store your javascript code in github.com, pastebin.com or any file cdn.

第1步:将您的javascript代码存储在github.com,pastebin.com或任何文件cdn中。

Step 2: Use below peace of code to call your javascript code from that external source:

第2步:使用以下代码安静来从外部源调用您的javascript代码:

<script src="http://example.com/script.js"/></script>

Include this code inside <head>

在中包含此代码

#5


2  

You should be able to add it to the page template. You can edit them from within the Blogger interface or download/edit/upload them.

您应该能够将其添加到页面模板中。您可以在Blogger界面中编辑它们,也可以下载/编辑/上传它们。

#6


1  

Select Template. And click 'Edit HTML'. Now you can add your script.

选择模板。然后点击“修改HTML”。现在您可以添加脚本了。

enter image description here


注意!

本站翻译的文章,版权归属于本站,未经许可禁止转摘,转摘请注明本文地址:https://www.itdaan.com/blog/2011/06/23/7129fe59a1e6df12991a2d4eee3aac09.html



 
粤ICP备14056181号  © 2014-2021 ITdaan.com