Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #31805
| Newsgroups | comp.lang.javascript |
|---|---|
| Date | 2016-12-11 16:23 -0800 |
| Message-ID | <e02b3e17-0584-4751-ac26-28897820e1c2@googlegroups.com> (permalink) |
| Subject | How to deal with "messy" quotes? |
| From | justaguy <lichunshen84@gmail.com> |
HTML:
<html>
<body>
<span id="nav"></span>
</body>
</html>
JavaScript:
<script>
var s = document.getElementById('nav'),
num = 0,
fn = " a new field name ";
/* in my actual code, the var s represent an element dynamically created
but to get key point across I'm using static element here
*/
s.innerHTML = " " + fn + " <input type='button' value='x' onclick = 'newFN("+fn+" + "," +num+);'>";
var newFN = function(f,n) {
console.log(f,n);
}
</script>
Intention:
for the s.innerHTML to have a button, with a "+" value/sign, upon click of which, it loads a function named "newFN" with two parameters
Problem:
Not sure to how to manage the quotes (both singles and doubles) for the s.innerHTML line, the right side of the equation.
Thanks.
Back to comp.lang.javascript | Previous | Next — Next in thread | Find similar | Unroll thread
How to deal with "messy" quotes? justaguy <lichunshen84@gmail.com> - 2016-12-11 16:23 -0800
Re: How to deal with "messy" quotes? JJ <jj4public@vfemail.net> - 2016-12-12 12:42 +0700
Re: How to deal with "messy" quotes? justaguy <lichunshen84@gmail.com> - 2016-12-12 09:56 -0800
Re: How to deal with "messy" quotes? JJ <jj4public@vfemail.net> - 2016-12-13 18:18 +0700
Re: How to deal with "messy" quotes? JJ <jj4public@vfemail.net> - 2016-12-13 18:22 +0700
Re: How to deal with "messy" quotes? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-12-13 13:10 +0100
Re: How to deal with "messy" quotes? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-12-12 20:43 +0100
Re: How to deal with "messy" quotes? <cyber@example.com> - 2016-12-12 17:53 +0000
Re: How to deal with "messy" quotes? justaguy <lichunshen84@gmail.com> - 2016-12-12 10:05 -0800
Re: How to deal with "messy" quotes? <cyber@example.com> - 2016-12-12 18:15 +0000
Re: How to deal with "messy" quotes? justaguy <lichunshen84@gmail.com> - 2016-12-12 14:10 -0800
Re: How to deal with "messy" quotes? justaguy <lichunshen84@gmail.com> - 2016-12-12 16:56 -0800
Re: How to deal with "messy" quotes? <cyber@example.com> - 2016-12-13 11:49 +0000
Re: How to deal with "messy" quotes? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-12-13 13:17 +0100
Re: How to deal with "messy" quotes? <cyber@example.com> - 2016-12-13 18:32 +0000
Re: How to deal with "messy" quotes? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-12-13 19:47 +0100
Re: How to deal with "messy" quotes? <cyber@example.com> - 2016-12-13 19:43 +0000
Re: How to deal with "messy" quotes? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-12-14 12:24 +0100
Re: How to deal with "messy" quotes? justaguy <lichunshen84@gmail.com> - 2016-12-13 17:07 -0800
Re: How to deal with "messy" quotes? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-12-12 21:19 +0100
Re: How to deal with "messy" quotes? justaguy <lichunshen84@gmail.com> - 2016-12-12 12:51 -0800
Re: How to deal with "messy" quotes? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-12-12 20:50 +0100
csiph-web