So now it says "I am the best pet rock youll ever have." The "youll" is killing the copywriter in me, but I'll leave it for now. At least it works.
ie:
< onload="alert('I am the best pet rock youll ever have');"> works, but,
< onload="alert('I am the best pet rock you'll ever have');"> doesn't.
[Maybe there's a way to add quotation marks in there to keep the string whole?]
Luckily, that was an easy bug to figure out. Though there must be a way around apostrophe's breaking alerts, right?
(follow up: you know that "there are no dumb questions" section of the book? Well, on the next page it explains that you can use apostrophes OR quotes in your string, you just have to use the other on the outside. So I guess you can't use both at the same time.)
(follow up 2: a coworker who's a Javascript expert, I'll call him DevGuy1, just informed me that you can get around this another way...using \' (which, apparently, is called "escaping a character.")
alert('I am the best pet rock you\'ll ever have');[Sweet.]
No comments:
Post a Comment