尝试在 javascript 中构建一个随机报价生成器,但它说我的函数调用值未定义
Trying to build a random quote generator in javascript, but it says my function call value is undefined
所以,我正在尝试在 HTML/JavaScript 中构建一个随机报价生成器。好吧,更多的是随机的日本表情符号生成器。
直到最近我才遇到问题,它一直说我的新表情符号函数未定义。
这是代码 -
<html>
<head>
<style>
<meta charset="utf-8">
<title> Japanese Emoticon Generator </title>
<meta name= “description” content=“A Japanese emoticon generator for all your Japanese emoticon needs.”>
</style>
</head>
<body>
<h1>Japanese Emoticon Generator </title>
<br>
<button onclick="newEmoticon()">Generate!</button>
<div id="emoticonDisplay">
</div>
<h3>All emoticons credit of <a href="http://japaneseemoticons.me/">japaneseemoticons.me</a> and <a href="https://textfac.es/">textfac.es</a></h3>
<script>
var emoticons = [
't(〃⊙౪ ∩=)/', '-(๑☆‿ ☆#)ᕗ', '((☆^⌓ ^☆)╭',
'((o⊙Σ ⊙。)m', '「(;´Σ `〃)ヘ', '「(#Φ益 Φo)∩',
'「(=>o≦=)ノ', '~(。☉︵ ಠ@)>', '~(๑ñ﹏ ⊙☆)ノ',
'⊂(o•ิ▂ ñ*)づ', '┗( ●-﹏ `。)づ', '╭ (oㅇ‿ o#)ᕗ
╮', '(☆-_ ⊙;)ゞ', '╰(๑^⌓ ^=)ᕗ', 'ヾ (;・﹏ •̀☆)b
ヾ', '(✿>﹏ ⊙〃)ノ', 'ヽ(♡≧m´。)っ', 'm(★⊙¬ ㅇ ●)ლ',
'O(*@д o#)づ', 'O(o^O `;)人', 'Σ(@°xº♡)/',
'Σ(♡@﹏ @☆)ノ”', 'Σ(๑+⌓ o。)シ', 'φ( ●⌒へ ⌒〃)o',
'ψ(๑∩⌓ ∩ ●)y', 'щ (*ㅇ△ Φ☆)ノ', 'ლ (#`ロ^;)>',
'ᕙ (;`⊥ ^★)┐', 'ᕙ (✿⊙へ ⊙〃)', 'ᕙ (❁^д ^*)っ',
'ᕦ(;*Σ ⌒❁)ᕗ', 'へ( ●`ㅅ `☆)ლ', 'へ(。•ิ‿ -〃)',
'┗(•̀へ •́ ╮ )', '╭( ✖_✖ )╮', '( ͡° ͜ʖ ͡°)', '∠( ᐛ 」∠)_ ',
'(゚⊿゚)', 'ᕕ( ᐛ )ᕗ', '_へ__(‾◡◝ )>', '( ᐛ )و',
'( ◞・౪・) ', '¯\_༼ ି ~ ି ༽_/¯', '¯\_༼ ಥ ‿ ಥ ༽_/¯',
'¯\_(⊙_ʖ⊙)_/¯', '¯\_| ✖ 〜 ✖ |_/¯', '¯\_▐ ☯ ︿ ☯ ▐_/¯',
'¯\_╏ ՞ ︿ ՞ ╏_/¯ ', '¯\_(⊙︿⊙)_/¯ ', '¯\_ȌᴥȌ_/¯',
'¯\_ʘᗜʘ_/¯', '¯\_ȌᴥȌ_/¯' , '( ;`ヘ´)', '((( ̄へ ̄井)',
'(`へ´*)ノ', '( ̄へ ̄)', '(。-`へ´-。)', 'ε-(‘ヘ´○)┓',
'(≧ヘ≦ )', 'ρ( ̄ヘ ̄ メ)', '(*`・へ・´*)',
'(((0へ0)', '(*`へ´*) 彡3', '(`へ′)'
];
//More will be gradually added in the future. Be patient.
function newEmoticon() {
var random = Math.floor(Math.random() * (emoticons.length));
document.getElementById('emoticonDisplay').innerHTML = emoticons[random];
}
</script>
</body>
</html>
我已经尝试 google 搜索并重写代码,但我没有得到任何结果。
谢谢。
你第23行有错误,以后用浏览器开发者工具找找类似的东西,试试这个
<html>
<head>
<style>
<meta charset="utf-8">
<title> Japanese Emoticon Generator </title>
<meta name= “description” content=“A Japanese emoticon generator for all your Japanese emoticon needs.”>
</style>
</head>
<body>
<h1>Japanese Emoticon Generator </title>
<br>
<button onclick="newEmoticon()">Generate!</button>
<div id="emoticonDisplay">
</div>
<h3>All emoticons credit of <a href="http://japaneseemoticons.me/">japaneseemoticons.me</a> and <a href="https://textfac.es/">textfac.es</a></h3>
<script>
var emoticons = [
't(〃⊙౪ ∩=)/', '-(๑☆‿ ☆#)ᕗ', '((☆^⌓ ^☆)╭',
'((o⊙Σ ⊙。)m', '「(;´Σ `〃)ヘ', '「(#Φ益 Φo)∩',
'「(=>o≦=)ノ', '~(。☉︵ ಠ@)>', '~(๑ñ﹏ ⊙☆)ノ',
'⊂(o•ิ▂ ñ*)づ', '┗( ●-﹏ `。)づ', '╭ (oㅇ‿ o#)ᕗ ╮',
'(☆-_ ⊙;)ゞ', '╰(๑^⌓ ^=)ᕗ', 'ヾ (;・﹏ •̀☆)b ヾ',
'(✿>﹏ ⊙〃)ノ', 'ヽ(♡≧m´。)っ', 'm(★⊙¬ ㅇ ●)ლ',
'O(*@д o#)づ', 'O(o^O `;)人', 'Σ(@°xº♡)/',
'Σ(♡@﹏ @☆)ノ”', 'Σ(๑+⌓ o。)シ', 'φ( ●⌒へ ⌒〃)o',
'ψ(๑∩⌓ ∩ ●)y', 'щ (*ㅇ△ Φ☆)ノ', 'ლ (#`ロ^;)>',
'ᕙ (;`⊥ ^★)┐', 'ᕙ (✿⊙へ ⊙〃)', 'ᕙ (❁^д ^*)っ',
'ᕦ(;*Σ ⌒❁)ᕗ', 'へ( ●`ㅅ `☆)ლ', 'へ(。•ิ‿ -〃)',
'┗(•̀へ •́ ╮ )', '╭( ✖_✖ )╮', '( ͡° ͜ʖ ͡°)', '∠( ᐛ 」∠)_ ',
'(゚⊿゚)', 'ᕕ( ᐛ )ᕗ', '_へ__(‾◡◝ )>', '( ᐛ )و',
'( ◞・౪・) ', '¯\_༼ ି ~ ି ༽_/¯', '¯\_༼ ಥ ‿ ಥ ༽_/¯',
'¯\_(⊙_ʖ⊙)_/¯', '¯\_| ✖ 〜 ✖ |_/¯', '¯\_▐ ☯ ︿ ☯ ▐_/¯',
'¯\_╏ ՞ ︿ ՞ ╏_/¯ ', '¯\_(⊙︿⊙)_/¯ ', '¯\_ȌᴥȌ_/¯',
'¯\_ʘᗜʘ_/¯', '¯\_ȌᴥȌ_/¯' , '( ;`ヘ´)', '((( ̄へ ̄井)',
'(`へ´*)ノ', '( ̄へ ̄)', '(。-`へ´-。)', 'ε-(‘ヘ´○)┓',
'(≧ヘ≦ )', 'ρ( ̄ヘ ̄ メ)', '(*`・へ・´*)',
'(((0へ0)', '(*`へ´*) 彡3', '(`へ′)'
];
//More will be gradually added in the future. Be patient.
function newEmoticon() {
var random = Math.floor(Math.random() * (emoticons.length));
document.getElementById('emoticonDisplay').innerHTML = emoticons[random];
}
</script>
</body>
</html>
所以,我正在尝试在 HTML/JavaScript 中构建一个随机报价生成器。好吧,更多的是随机的日本表情符号生成器。
直到最近我才遇到问题,它一直说我的新表情符号函数未定义。
这是代码 -
<html>
<head>
<style>
<meta charset="utf-8">
<title> Japanese Emoticon Generator </title>
<meta name= “description” content=“A Japanese emoticon generator for all your Japanese emoticon needs.”>
</style>
</head>
<body>
<h1>Japanese Emoticon Generator </title>
<br>
<button onclick="newEmoticon()">Generate!</button>
<div id="emoticonDisplay">
</div>
<h3>All emoticons credit of <a href="http://japaneseemoticons.me/">japaneseemoticons.me</a> and <a href="https://textfac.es/">textfac.es</a></h3>
<script>
var emoticons = [
't(〃⊙౪ ∩=)/', '-(๑☆‿ ☆#)ᕗ', '((☆^⌓ ^☆)╭',
'((o⊙Σ ⊙。)m', '「(;´Σ `〃)ヘ', '「(#Φ益 Φo)∩',
'「(=>o≦=)ノ', '~(。☉︵ ಠ@)>', '~(๑ñ﹏ ⊙☆)ノ',
'⊂(o•ิ▂ ñ*)づ', '┗( ●-﹏ `。)づ', '╭ (oㅇ‿ o#)ᕗ
╮', '(☆-_ ⊙;)ゞ', '╰(๑^⌓ ^=)ᕗ', 'ヾ (;・﹏ •̀☆)b
ヾ', '(✿>﹏ ⊙〃)ノ', 'ヽ(♡≧m´。)っ', 'm(★⊙¬ ㅇ ●)ლ',
'O(*@д o#)づ', 'O(o^O `;)人', 'Σ(@°xº♡)/',
'Σ(♡@﹏ @☆)ノ”', 'Σ(๑+⌓ o。)シ', 'φ( ●⌒へ ⌒〃)o',
'ψ(๑∩⌓ ∩ ●)y', 'щ (*ㅇ△ Φ☆)ノ', 'ლ (#`ロ^;)>',
'ᕙ (;`⊥ ^★)┐', 'ᕙ (✿⊙へ ⊙〃)', 'ᕙ (❁^д ^*)っ',
'ᕦ(;*Σ ⌒❁)ᕗ', 'へ( ●`ㅅ `☆)ლ', 'へ(。•ิ‿ -〃)',
'┗(•̀へ •́ ╮ )', '╭( ✖_✖ )╮', '( ͡° ͜ʖ ͡°)', '∠( ᐛ 」∠)_ ',
'(゚⊿゚)', 'ᕕ( ᐛ )ᕗ', '_へ__(‾◡◝ )>', '( ᐛ )و',
'( ◞・౪・) ', '¯\_༼ ି ~ ି ༽_/¯', '¯\_༼ ಥ ‿ ಥ ༽_/¯',
'¯\_(⊙_ʖ⊙)_/¯', '¯\_| ✖ 〜 ✖ |_/¯', '¯\_▐ ☯ ︿ ☯ ▐_/¯',
'¯\_╏ ՞ ︿ ՞ ╏_/¯ ', '¯\_(⊙︿⊙)_/¯ ', '¯\_ȌᴥȌ_/¯',
'¯\_ʘᗜʘ_/¯', '¯\_ȌᴥȌ_/¯' , '( ;`ヘ´)', '((( ̄へ ̄井)',
'(`へ´*)ノ', '( ̄へ ̄)', '(。-`へ´-。)', 'ε-(‘ヘ´○)┓',
'(≧ヘ≦ )', 'ρ( ̄ヘ ̄ メ)', '(*`・へ・´*)',
'(((0へ0)', '(*`へ´*) 彡3', '(`へ′)'
];
//More will be gradually added in the future. Be patient.
function newEmoticon() {
var random = Math.floor(Math.random() * (emoticons.length));
document.getElementById('emoticonDisplay').innerHTML = emoticons[random];
}
</script>
</body>
</html>
我已经尝试 google 搜索并重写代码,但我没有得到任何结果。
谢谢。
你第23行有错误,以后用浏览器开发者工具找找类似的东西,试试这个
<html>
<head>
<style>
<meta charset="utf-8">
<title> Japanese Emoticon Generator </title>
<meta name= “description” content=“A Japanese emoticon generator for all your Japanese emoticon needs.”>
</style>
</head>
<body>
<h1>Japanese Emoticon Generator </title>
<br>
<button onclick="newEmoticon()">Generate!</button>
<div id="emoticonDisplay">
</div>
<h3>All emoticons credit of <a href="http://japaneseemoticons.me/">japaneseemoticons.me</a> and <a href="https://textfac.es/">textfac.es</a></h3>
<script>
var emoticons = [
't(〃⊙౪ ∩=)/', '-(๑☆‿ ☆#)ᕗ', '((☆^⌓ ^☆)╭',
'((o⊙Σ ⊙。)m', '「(;´Σ `〃)ヘ', '「(#Φ益 Φo)∩',
'「(=>o≦=)ノ', '~(。☉︵ ಠ@)>', '~(๑ñ﹏ ⊙☆)ノ',
'⊂(o•ิ▂ ñ*)づ', '┗( ●-﹏ `。)づ', '╭ (oㅇ‿ o#)ᕗ ╮',
'(☆-_ ⊙;)ゞ', '╰(๑^⌓ ^=)ᕗ', 'ヾ (;・﹏ •̀☆)b ヾ',
'(✿>﹏ ⊙〃)ノ', 'ヽ(♡≧m´。)っ', 'm(★⊙¬ ㅇ ●)ლ',
'O(*@д o#)づ', 'O(o^O `;)人', 'Σ(@°xº♡)/',
'Σ(♡@﹏ @☆)ノ”', 'Σ(๑+⌓ o。)シ', 'φ( ●⌒へ ⌒〃)o',
'ψ(๑∩⌓ ∩ ●)y', 'щ (*ㅇ△ Φ☆)ノ', 'ლ (#`ロ^;)>',
'ᕙ (;`⊥ ^★)┐', 'ᕙ (✿⊙へ ⊙〃)', 'ᕙ (❁^д ^*)っ',
'ᕦ(;*Σ ⌒❁)ᕗ', 'へ( ●`ㅅ `☆)ლ', 'へ(。•ิ‿ -〃)',
'┗(•̀へ •́ ╮ )', '╭( ✖_✖ )╮', '( ͡° ͜ʖ ͡°)', '∠( ᐛ 」∠)_ ',
'(゚⊿゚)', 'ᕕ( ᐛ )ᕗ', '_へ__(‾◡◝ )>', '( ᐛ )و',
'( ◞・౪・) ', '¯\_༼ ି ~ ି ༽_/¯', '¯\_༼ ಥ ‿ ಥ ༽_/¯',
'¯\_(⊙_ʖ⊙)_/¯', '¯\_| ✖ 〜 ✖ |_/¯', '¯\_▐ ☯ ︿ ☯ ▐_/¯',
'¯\_╏ ՞ ︿ ՞ ╏_/¯ ', '¯\_(⊙︿⊙)_/¯ ', '¯\_ȌᴥȌ_/¯',
'¯\_ʘᗜʘ_/¯', '¯\_ȌᴥȌ_/¯' , '( ;`ヘ´)', '((( ̄へ ̄井)',
'(`へ´*)ノ', '( ̄へ ̄)', '(。-`へ´-。)', 'ε-(‘ヘ´○)┓',
'(≧ヘ≦ )', 'ρ( ̄ヘ ̄ メ)', '(*`・へ・´*)',
'(((0へ0)', '(*`へ´*) 彡3', '(`へ′)'
];
//More will be gradually added in the future. Be patient.
function newEmoticon() {
var random = Math.floor(Math.random() * (emoticons.length));
document.getElementById('emoticonDisplay').innerHTML = emoticons[random];
}
</script>
</body>
</html>