我有一个民意调查代码(javascript):
<script type="text/javascript" src="http://i0.poll.fm/survey.js" charset="UTF-8"></script>
<script type="text/javascript" charset="utf-8">
polldaddy.add( {
type: 'slider',
embed: 'poll',
delay: 100,
visit: 'single',
id: 7523190
} );
</script>
我想说:
{
type: 'slider',
embed: 'poll',
delay: 100,
visit: 'single',
id: 7523190
} );
外部.jss文件中的那部分。做这个的最好方式是什么?它甚至可能吗?是否有类似javascript的ID选择器?喜欢#是CSS吗?
谢谢x
请注意:
我试过了,但它仍然不起作用:
<script type="text/javascript">
$("polldaddy.add")
{
type: 'slider',
embed: 'poll',
delay: 100,
visit: 'single',
id: 7523190
} );
</script>
更新kevinB消息:
我已经尝试过你所说的,仍然无效检查我的代码:
HTML:
<!DOCTYPE html>
<html>
<head>
<title>De auteur</title>
<link href="stylesheet.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="myscript.js" charset="utf-8"></script>
myscript.jss:
<script type="text/javascript" src="http://i0.poll.fm/survey.js" charset="UTF-8"></script>
<script type="text/javascript" charset="utf-8">
polldaddy.add( {
type: 'slider',
embed: 'poll',
delay: 100,
visit: 'single',
id: 7523190
} );
</script>
<noscript><a href="http://polldaddy.com/poll/7523190/">Ga jij bewust om met social media?</a></noscript>
</script>
不知道我做错了什么,但它仍然不起作用!
答案 0 :(得分:0)
如何将其定义为外部JavaScript文件中的变量,然后使用该变量添加轮询?类似的东西:
pollData.js:
var pollData = {
type: 'slider',
embed: 'poll',
delay: 100,
visit: 'single',
id: 7523190
};
HTML:
<script src="http://i0.poll.fm/survey.js"></script>
<script src="pollData.js"></script>
<script>
polldaddy.add(pollData);
</script>