JavaScript - Add Single Quotes To String
How can I add single quotes around listObj.options[i].value. I still want to keep the comma I'm adding to the end of it.
Code: CSV += listObj.options[i].value + ','; Similar TutorialsHi Can you please advise on this. When writing javascript what is best practice.... single or double quotes? I tried to research this and everyone contracdicts each other? thanks A Hi , I have a data coming as a string which contains single quotes and double quotes but it is showing up as Code: ' and " it should show it as Code: ' and " How do I fix this issue. in JavaScript. action3.innerHTML = '<input type="button" class="menuButtons" id="menuButton1" value="Lab1" onclick="requestWindow("e;../lab1.html"e;)" />... how can I fix that. I tried "es for a third quote after already using single quotes and double quotes but it still hates me =[ Code: <html> <body> <div id="link"> <a href="http://www.facebook.com/">Facebook</a> </div> <script type="text/javascript"> var addr=new Array(); addr[0]="http://www.google.com/"; addr[1]="http"//www.yahoo.com/"; addr[2]="http://www.bing.com/"; var rl=document.getElementById("link"); var ri=Math.floor(Math.random()*3); rl.innerHTML= </script> </body> </html> I got stuck in getting this to work (show random element of the array as a link with description) Code: rl.innerHTML='<a href="addr[ri]">addr[ri]</a>'; This is showing addr[ri] on a page and directs to www.domain.com/addr[ri] Thank you in advance for any info. i've made an app in php/mysql which generates random quotes at intervals. i'm trying to integrate it with facebook. if i use iframes, everything works smoothly except for one issue, that facebook doesn't support iframe in profile boxes - which is what i want. for this reason, i prefer to use fbml. however, i'm using jquery to get the quotes from the php file, and this doesn't work in fbml. i read that with fbml, i can work with fbjs. since i do not know fbjs, i'm stuck. how do i convert the jquery code to get the quotes from php to fbjs? specifically, which part from the jquery file do i need to convert to fbjs, to get my code to work using fbjs? any help would be appreciated. i tried using fbjqry, but it didn't work. this is my code: Code: <!DOCTYPE html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <link rel="stylesheet" type="text/css" href="css/jquote.css" /> <!--<script type="text/javascript" src="scripts/jquery-1.4.2.js"></script>--> <script type="text/javascript" src="fbjqry/utility.js"></script> <script type="text/javascript" src="fbjqry/fjqry.js"></script> <script type="text/javascript"> // On page load, fill the box with content. $(document).ready(function() { $("#quoteContainer").load("quote.php"); }); var auto_refresh = setInterval( function () { $('#quoteContainer').load('quote.php'); }, 5000); // refresh every 10000 milliseconds </script> </head> <div id="wrapper"> <div class="header"> Quote of the Day</div> <div id="quoteContainer"> </div> </div> </html> This little snippet of code produces random quotes but sometimes gives a missing quote between two quote marks. Code: <HTML> <HEAD> <TITLE>Javascript - RANDOM QUOTES</TITLE> <script type="text/javascript"> function quote() { //Random Quotes } ; q = new quote() ; n = 0 // Quote database------------------------------------ q[n++]= "<FONT FACE =\"Trebuchet MS\" SIZE=\"2\" COLOR='#0006C7'>'QUOTE 1' (PERSON 1)</FONT>"; q[n++]= "<FONT FACE =\"Trebuchet MS\" SIZE=\"2\" COLOR='#0006C7'>'QUOTE 2' (PERSON 2)</FONT>"; </script> </HEAD> <BODY> <HR> <script type="text/javascript"> i=Math.floor(Math.random() * n) ; document.write( q[i] ); </SCRIPT> <HR> </BODY> </HTML> Can someone explain why? I use around 50 quotes in the real thing. Hi, I have completed the necessary function and it does not need any changes however from the "alert" I need there has to be double quotes surrounding the search 'Lboro'. (I know I may be making a meal of the coding however the lecturer wants us to follow this due to everyone being at different levels of programming). I have used the '\' character however the double quotes do not end up in the position I require them?! My Coding function findAnyU (s){ var a = s , b , c , d , e = -1; for (var i = 0 ; i < pages.length && e == -1 ; i++){ b = pages[i].indexOf('['); c = pages[i].indexOf(']'); d = pages[i].substring(b+1, c).toLowerCase(); e = d.indexOf(s.toLowerCase()); } if(e >= 1) a += ' found' else a += ' not found' return (a) } alert (findAnyU('Lboro' , pages)); Current Alert = Lboro found Cheers George This is my very first javascript (I have limited knowledge C++ and php). I am trying to make an instant quote calculator, but having some trouble. I want to display the result of the calculation in the textbox with id price. Code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>OVP Custom Order</title> <script language="javascript"> <!-- function calcul(){ var vmin = document.getElementById('dur_min')[document.getElementById('dur_min').selectedIndex].value; var vsec = document.getElementById('dur_sec')[document.getElementById('dur_sec').selectedIndex].value; var vscript = document.getElementById('script')[document.getElementById('script').selectedIndex].value; var vvstock = document.getElementById('vis_stock')[document.getElementById('vis_stock').selectedIndex].value; var vvvideo = document.getElementById('vis_video')[document.getElementById('vis_video').selectedIndex].value; var vvanim = document.getElementById('vis_anim')[document.getElementById('vis_anim').selectedIndex].value; var vvoice = document.getElementById('voice')[document.getElementById('voice').selectedIndex].value; var vmusic = document.getElementById('music')[document.getElementById('music').selectedIndex].value; vmin = vmin*1; vsec = vsec*1; vscript = vscript*1; vvstock = vvstock*1; vvvideo = vvvideo*1; vvanim = vvanim*1; vvoice = vvoice*1; vvmusic = vvmusic*1; var overhead = 547; cost = (vmin+vsec)*(vscript+vvstock+vvvideo+vvanim+vvoice+vmusic+overhead); document.getElementById('price').value = cost; } // --> </script> </head> <body> <form id="form1" name="main"> <label>Duration <select id="dur_min"> <option value="0">0</option> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> <option value="5">5</option> <option value="6">6</option> <option value="7">7</option> <option value="8">8</option> <option value="9">9</option> <option value="10">10</option> <option value="11">11</option> <option value="12">12</option> <option value="13">13</option> <option value="14">14</option> <option value="15">15</option> <option value="16">16</option> <option value="17">17</option> <option value="18">18</option> <option value="19">19</option> <option value="20">20</option> <option value="21">21</option> <option value="22">22</option> <option value="23">23</option> <option value="24">24</option> <option value="25">25</option> <option value="26">26</option> <option value="27">27</option> <option value="28">28</option> <option value="29">29</option> <option value="30">30</option> </select> </label> mins <label> <select name="dur_sec" id="dur_sec"> <option value="0">00</option> <option value="0.25">15</option> <option value="0.5">30</option> <option value="0.75">45</option> </select> </label> seconds<br /> <label><br /> Script Provided by <select name="script" id="script"> <option value="0">Client</option> <option value="200">OVP</option> </select> </label> <br /> <br /> Visuals<br /> <label> <input value="100" type="checkbox" name="vis_stock" id="vis_stock" /> Stock Image Library</label> <br /> <label> <input value="300" type="checkbox" name="vis_video" id="vis_video" /> Video Shoot</label> <br /> <label> <input value="200" type="checkbox" name="vis_animation" id="vis_animation" /> Animation & Graphics</label> <br /> <label><br /> Voiceovers <select name="voiceovers" id="voiceovers"> <option value="0">No</option> <option value="200">Yes</option> </select> </label> <br /> <label><br /> Royalty Free Music <select name="music" id="music"> <option value="0">No</option> <option value="50">Yes</option> </select> </label> <br /> <br /> Output Format(s)<br /> <label> <input type="checkbox" name="out_web" id="out_web" /> Web</label> <label> <input type="checkbox" name="out_dvd" id="out_dvd" /> DVD</label> <label> <input type="checkbox" name="out_download" id="out_download" /> Download</label> <br /> <br /> <label> <input type="submit" name="submit" id="submit" value="Calculate" onClick="calcul()"/> </label> <label>Approximate Price <input name="price" type="text" id="price" size="10" virtual warp="on" /> </label> <br /> </form> </body> </html> Thanks in advance I am just learning the basics and am trying to figure out timing with setTimeout() Code: <script type="text/javascript"> document.write("<p>" + Date() + "</p>"); setTimeout("document.write('Hello There World');", 2000); setTimeout("document.write("<p>" + Date() + "</p>");", 2000); </script> the 1st document.write works and the 1st setTimeout() works, but then I add the fourth line and the page will not load. Why does it not like my 4th line : "setTimeout("document.write("<p>" + Date() + "</p>");", 2000);"? I've got this bit of code that I've wrote and it was working absolutely fine like this: Code: function validatepostcode() { var postcodevalue = document.getElementById("postcode").value; if (postcodevalue.indexOf("S") == -1) { alert(postcodevalue + " is not a valid postcode."); } } Until I tried to add double quotes: Code: function validatepostcode() { var postcodevalue = document.getElementById("postcode").value; if (postcodevalue.indexOf("S") == -1) { alert( \" postcodevalue \" + " is not a valid postcode."); } } What I want to do is wrap the value of "postcodevalue" in double quotes, and since it's inside an alert, I used the escape sequence \", which is how it should be done as far as I know. But for some reason, Dreamweaver's giving me a syntax error warning and the code doesn't work. Am I using the double quotes wrong? Regards, Hashim. Good morining, I'm working on a javascript for a rollover menu that the client is regularly changing. I want to create a call to a remote "document write" script on each page so that when it changes I only have to modify it in the script rather than on every page of the site. The problem I am having is that I cannot figure out how to include the quotes needed to execute the rollovers without killing the script. I tried removing all the quotes, and the "\" method as I would with a perl script, (and MANY other attempts) but no go. Here is where I'm at right now. I would appreciate any suggestions or links to info I can read to learn from. Call to the script in the html page(s): Code: <SCRIPT language="JavaScript" SRC="Nav_11Set.js"></SCRIPT> The script (condensed to one image): Code: document.write('<table id=Table_01 width=143 height=264 border=0 cellpadding=0 cellspacing=0><tr><td><a href=http://www.minersalley.com/Memberships.html onmouseover=changeImages('Nav_11Set_01', 'images/Nav_11Set_01-over.jpg'); return true;onmouseout=changeImages('Nav_11Set_01', 'images/Nav_11Set_01.jpg'); return true;onmousedown=changeImages('Nav_11Set_01', 'images/Nav_11Set_01-down.jpg'); return true; onmouseup=changeImages('Nav_11Set_01', 'images/Nav_11Set_01-over.jpg'); return true;><img name=Nav_11Set_01 src=images/Nav_11Set_01.jpg width=143 height=24 border=0 alt=Membership Info!></a></td></tr></table>') I'm trying to insert a title and a body into a Google maps window through PHP. The body could contain double or single quotes. How do I output these so that they don't break the script? Relevant code: Code: $('#map_canvas').gmap('openInfoWindow', { 'content': '<strong><?php echo $m->marker->Title; ?></strong><br /><?php echo $m->marker->Body; ?><?php echo '<a href="./marker_info.php?id='.$m->marker->Nid.'"></a>' ?><br /><a id="m_location" href="#" data-role="button" data-icon="search" onclick="$.mobile.silentScroll(500);"></a>'}, this); Hey all, have a bit of a problem. I'm trying to store a variable in Javascript that consist of user input that may include both quotes and apostraphes (amongst any other stuff). Currently looks a bit like this: Code: <script> var importantNote = [[Note]]; if (importantNote != "" && importantNote != " ") { var importantNoteOutput = "<div class=\"important\"><h3>Important Note:</h3> [[Note]]</div>"; document.write (importantNoteOutput); } </script> Obviously, when [[Note]] (another variable pulled through a seperate program to create complete code) contains ", it doesn't go so well ('[[Note]]' solves that, but creates same issue with any plurals ). I *could* get end user (probably me) to always ensure anything entered in this field (and few others used in a similar way) contain escaped characters, but this isn't preferable. Preferably, I'd like a way of escaping an entire string automatically, eg. encode([[Note]]) - though that doesn't seem to work. Any quick tips? FWIW, I don't think I can use php, or much else for the task. Pretty much stuck with html and javascript. Thanks Hey all, I have a simple example below showing how when I pass in the value of the value attribute of option node, and then use if operator to check whether parameter is a string or not, even though it's a string, it converts it to false boolean and triggers the else statement rather than calling a function: Code: <body> <select> <option value="createMsg">Add Message</option> <option value="removeMsg">Remove Message</option> </select> </body> Code: var menu = { handleMenu : function(callback){ if(callback === "string"){ menu[callback](); } else { console.log("Issue occurred") } }, createMsg : function(){ var content = document.createTextNode("Please give additional information."), heading = document.createElement("h1"); heading.appendChild(content); document.body.appendChild(heading); }, removeMsg : function(){ } } document.getElementsByTagName('select')[0].onchange = function(){ menu.handleMenu(this.value)}; callback should be a string so why is it saying otherwise? Thanks for response Hey everyone, I'm new here so be gentle I ran into a website called livethesheendream.com when the whole charlie sheen drama was going on. I really liked the way the simple site was designed and would like to create something similar to the layout but totally different topic. My question is, can someone modify the script so that when someone clicks on the image or if they click on the "quote" it will show the next quote BUT in the order I want it to be, for example... it will start with "1" when the open the page, then when you click the picture or "1" it will show "2", then "3" and so on. I will write out all the quotes and have the user just click next, next, next. I hope that makes sense. I copied and posted the source code i got from livethesheendream.com if that helps. PM me if you need to, I will be online most the day. Thank you to anyone who can help me! Code: <!doctype html> <html> <head> <title>Live the Sheen Dream</title> <link href="styles/screen.css" rel="stylesheet" type="text/css" /> <meta name="description" content="A random quote generator from Charlie Sheen's recent rants and words of wisdom." /> <meta name="keywords" content="charlie sheen, sheen, quotes, quote generator, meme, charlie sheen crazy, charlie sheen insane, charlie sheen rant, rant, charlie sheen drugs, f-18, winning, charlie sheen winning" /> <meta name="robots" content="index, follow" /> <script type="text/javascript"> var _gaq = _gaq || []; _gaq.push(['_setAccount', 'UA-21696467-1']); _gaq.push(['_trackPageview']); (function() { var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); </script> </head> <body> <div id="wrapper"> <center><p><a href="http://www.livethesheendream.com/" onclick="randomQuote(); return false;"><img src="http://www.livethesheendream.com/images/sheen.jpg" alt="sheen" /></a></p></center> <h4><p>( click the head. )</p></h4> <h1><blockquote id="quote">Get the cancer out of the mix.</blockquote></h1> <center> <script src="http://connect.facebook.net/en_US/all.js#xfbml=1"></script><fb:like href="http://livethesheendream.com/" layout="button_count" show_faces="false" font="arial"></fb:like> </center> <br /> <center> <a href="http://twitter.com/share" class="twitter-share-button" data-count="horizontal" >Tweet</a><script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script> </center> <br /> <center><h3> <a href="mailto:info@livethesheendream.com" target="_blank">contact us</a> </h3></center> <script type="text/javascript"> var quotes = ["Good luck on your travels. You\u2019re going to need it. Badly.","Sorry man, didn\u2019t make the rules.","I embarrassed him in front of his children and the world.","I\u2019ve got magic. I\u2019ve got poetry at my fingertips.","Mistook this rockstar, bro.","The only thing I\u2019m addicted to right now is winning.","I\u2019m not Thomas Jefferson. He was a pussy.","My success rate is 100 percent. Do the math.","I\u2019m so tired of pretending my life isn\u2019t perfect and *****in\u2019.","Imagine what I would have done with my fire-breathing fists.","Here\u2019s your first pee test. The next one goes in your mouth. No, you won\u2019t get high.","The scoreboard doesn\u2019t lie. Never has.","I am battle-tested bayonets bro.","Where there were four, there are now three.","Just sit back and enjoy the show.","I have real fame. They have nothing.","Bring me a challenge. Somebody.","Pure and complete gnarly-isms.","There\u2019s my life. Deal with it. Oh, wait, can\u2019t process it? LOSERS.","A lot of people think Major League\u2019s called Wild Thing. As they should.","Why give an interview when you can leave a warning?","There\u2019s a new sheriff in town. And he has an army of assassins.","We work for the pope.","Gnarly gnarlingtons.","I am special, and I will never be one of you.","There are parts of me that are Dennis Hopper.","I don\u2019t live in the middle anymore. That\u2019s where you get embarrassed in front of the prom queen.","Thought you were messing with one dude? Sorry.","WINNING.","WINNING.","I\u2019m going to hang out with these two smoooooking hotties and fly privately around the world.","It might be lonely up here but I sure like the view.","I\u2019m done. It\u2019s on. Bring it.","I wanted to watch Jaws on the ocean in the dark and be afraid.","This guy\u2019s got more notches on his belt than Black Bart.","This is me not on drugs bro.","The first one\u2019s free. The next one goes in your mouth.","This contaminated little maggot can\u2019t handle my power.","Clearly I have defeated this earthworm with my words.","I closed my eyes and in a nanosecond I cured myself.","Quit hiding dude. It\u2019s embarrassing. Next subject.","It\u2019s funny how sheep rhymes with sleep.","Bull S-H-I-T.","I\u2019ve spent close to the last decade effortlessly and magically converting your tin cans into pure gold.","You\u2019ve been warned dude. Bring it.","Apocalypse Now will teach you how to live inside of a moment between a moment.","I have a disease? Bull****. I cured it with my brain.","If you\u2019re a part of my family, I will love you violently.","I look at the game of baseball and I\u2019m reminded of a quote that I wrote.","They couldn\u2019t extinguish my pilot light. And that was a mistake.","I\u2019m 45, I\u2019ve got five kids, and I\u2019ve been dumped on for too long.","One of my favorite poets is Eminem.","Let\u2019s hook up and just bring fiery death.","Watch me bury you.","I don\u2019t sleep. I wait.","Let\u2019s talk about something exciting. Me.","Everybody has a black belt and carries a gun. I don\u2019t mess with people.","I\u2019m rolling out magic, bro.","Go back to the troll hole where you came from.","I\u2019m just giving them what I guess they want, I just don\u2019t know if they can handle it. Pussies.","I guess I\u2019m just that goddamn *****in\u2019.","We\u2019re Vatican assassins. How complicated can it be?","Most of the time- and this includes naps- I\u2019m an F-18.","I don\u2019t know, winning, anyone? Rhymes with winning? Anyone? Yeah, that would be us.","I have one speed. I have one gear. Go.","I dare you to keep up with me.","I am on a drug. It\u2019s called Charlie Sheen.","I\u2019m an F-18 bro.","The run I was on made Sinatra, Flynn, Jagger and Richards look like droopy-eyed armless children.","Your face will melt off and your children will weep over your exploded body.","You should have read the directions before you showed up at the party.","I\u2019ve got tiger blood, man.","Your face will melt off and your children will weep over your exploded body.","I may forget about them tomorrow, but they\u2019ll live with that memory for the rest of their lives. And that\u2019s a gift.","I was banging seven gram rocks and finishing them. Because that\u2019s how I roll.","I have a different constitution.","I use a blender. I use a vacuum cleaner.","I\u2019m bi-winning. I win here, and I win there.","What\u2019s the cure? Medicine?","You borrow my brain for five seconds and just be like 'Dude, can\u2019t handle it. Unplug this *******.'","Basically they strapped on their diapers.","I exposed people to magic.","Shut up. Stop. Move forward.","Wow. What does that mean.","Resentments are the rocket fuel that lives in the tip of my sabre.","I\u2019m tired of pretending I\u2019m not a total, *****in\u2019 rock star from Mars.","Drug tests don\u2019t lie.","It\u2019s a war. And it\u2019s on.","Sorry my life is so much more *****in\u2019 than yours. I planned it that way.","I take great umbrage with that.","I don\u2019t have burnout in my gear box.","I\u2019m just going to sail across the winds of the universe with my goddesses.","That was the America I was raised in.","If people could just read behind the hieroglyphic.","I don\u2019t think people are ready for the message I\u2019m delivering.","They picked a fight with a warlock.","Faith is for winners. Hope is for losers.","Clearly he didn\u2019t bring gum for everyone.","I\u2019m going to win every moment.","That\u2019s the code. And we all live by it.","Here\u2019s your cold coffee. Buh-bye.","Surprise. That\u2019s what winners do.","I can\u2019t make up a hernia. That\u2019s just lame.","It\u2019s a three-letter word. It rhymes with why.","My conduct is *****in\u2019.","Come on bro, I won best picture at 20.","Your perimeter\u2019s been breached. You got work to do bro.","It was so gnarly I can\u2019t remember.","I\u2019m not recovering like some pussy.","Rock bottom? That\u2019s a fishing term.","I\u2019m a grandiose life, and I\u2019m embracing it.","Can\u2019t is the cancer of happen.","Dying is for fools. Amateurs.","When I\u2019m fighting a war there\u2019s no room for sensitivity.","If you can bring me a souvenir from that moment when your father locked you in the closet, then bring it to me.","She was attacking me with a small fork.","What was she doing with a shrimp fork in her purse?","I'm still alive, which is pretty cool.","Women are not to be hit. They are to be hugged and caressed.","I have a 10,000-year-old brain and the boogers of a seven-year-old.","Get over here and enjoy the ride, bro. We\u2019re starting to win.","I\u2019m not taking it. I had to pay for it.","Vintage balderdash.","I\u2019ve been a veteran of the unspeakable.","I literally woke up and it was Christmas.","It\u2019s been a tsunami. And I\u2019ve been riding it on a mercury surfboard.","We\u2019re on a rocket ship to the moon some nights.","I don\u2019t understand what I did wrong except live a life that everyone is jealous of.","Duh, WINNING.","Park your nonsense.","Don\u2019t live in the middle.","Adonis DNA.","We\u2019re shaking the tree. We\u2019re shaking all the trees.","I am grandiose. Because I live a grandiose life.","Celebrate this movement.","Get a job, anyone?","You can\u2019t process me with a normal brain.","I\u2019ve got tiger blood and Adonis DNA.","You\u2019ve been given magic. You\u2019ve been given gold.","Bi-polar? The Earth is bi-polar.","Damn, I didn\u2019t take care of myself. Again.","I just want to hug him and rub his head.","I\u2019m an exciting client.","What\u2019s not to love?","I\u2019m alive. Bring it.","Look at these sad trolls.","I\u2019m a peaceful man with bad intentions.","Sorry Middle America.","Who wants to deal with all the small talk?","Really dude? Really?","The last time I used? What do you mean? I used my toaster this morning.","Everything. Next question.","Can I have one part of my life that isn\u2019t TMZ\u2019d up the butt?","We need his wisdom and his *****in\u2019-ness.","Work fuels the soul.","Winning. Everyday.","Add some gold.","Change your brain.","People can\u2019t figure me out. They can\u2019t process me. I don\u2019t expect them to.","They can\u2019t hang with me. Their bones would melt like wax.","I\u2019m not \u2018aw shucks\u2019. Because I\u2019m gnarly.","Got to dismiss these clowns.","I\u2019m on a quest to claim absolute victory on every front.","Teamwork. Bang.","The wildfires are spreading. The meek are scattering.","They hate themselves first.","Biggest star in the world.","I\u2019m living inside the truth. And the truth doesn\u2019t change.","He has no salt in his soul.","C\u2019mon. The guy wears corduroys.","I honorably pass that torch to these young geniuses.","Change the channel. I dare you.","I\u2019ve been blessed with a new brain.","It\u2019s about winning. Sorry.","*****in\u2019 focus.","Get back in the game dude.","Get the cancer out of the mix.","Gnarly you are not.","Of course you\u2019re gnarly. You\u2019re talking to me.","Wow. That\u2019s epic.","That just flew out. That was a pretty good one.","It's a turd that opens on a tugboat.","If they want me in it, it's a smash.","No panic. No judgement.","Hope is for suckers and tools.","The people would revolt.","You can tell him one thing. I own him.","Missing a lot of good sports, people. Lots.","My passion was asleep for a long time.","I finally extracted myself from their troll hole.","They tell you to lay down your sword. Really? Wow, dude's unarmed. WHACK.","I think you've got a little more magic than you realize.","You make a choice to win, and you win.","I have to tip my hat to them.","There's a reason I've had mad success doing comedy.","Yeah I'll do a movie with you. You're awesome.","I don't forget anything, you know?","I can't pee in front of you guys.","Flinching's for amateurs.","He has no salt in his soul.","It's about winning. Sorry.","They can't really ruffle this assassin's feathers.","We form a group called the wedge.","Panicking is for amateurs and morons.","I don't believe in panicking.","They could have fleeced the sheep a thousand times, but they chose to skin it once.","It feels like the hot springs of Middle Earth are finally ready to explode outward.","It feels like the worm's turning.","It boils and it fuels you. It boils in a state that would eclipse a microwave.","Ride down the face of a tsunami and tell me you don't feel *****in'.","I\u2019m an F-18 bro."]; function randomQuote(){ var quote = document.getElementById("quote"); var rand = Math.ceil( Math.random() * (quotes.length - 1) ); quote.innerHTML = quotes[rand]; } </script> </div><!-- end wrapper --> </body> </html> Hello , everyone. Was wondering if you can put a single popup that could appear to many visitors to a site at the same time , regardless of the page you 're browsing . Is there a chance to do it in JavaScript or another language ? How could i do it? Iappreciate the help .
I've been looking for a client side Link Extraction script. I've found plenty that extract all links from the desired site, but I'm looking for one to just grab a specific link with a variable hash. Has anyone ran across something like this? Any info you may have would be great! Thanks! I am trying to make a JavaScript chat-bot I was using this to answer a month questions and it worked fine for what is the month after DatesA=new Array("january,February","february,March","march,April","april,May","may,June","june,July","july,Aug ust","august,September","september,October","october,November","november,December","december,January "); if (input.search("what is the next month after")!= -1) {document.result.result.value = "Sorry, I don't know."; for (i=0; i<DatesA.length; i++) { Date=DatesA[i].split('='); if (input.search(Date[0]) != -1) { document.result.result.value = Date[1];} } return true;} What is the month after May answer: June however it didn't with letters. Is there a way to write this to prevent the wrong single letter and small words from triggering Letterbefore=newArray("b=a","c=b","d=c","e=d","f=e","g=f","h=g","i=h","j=i","k=j","l=k","m=l","n=m", "o=n","p=o","q=p","r=q","s=r","t=s","u=t","v=u","w=v","x=w","y=x","z=y"); Then use this: if (input.search("what is the letter before")!= -1 || input.search("what letter comes before")!= -1) {document.result.result.value = "Sorry."; for (i=0; i<Letterbefore.length; i++) { Letter=Letterbefore[i].split('='); if (input.search(Letter[0]) != -1) { document.result.result.value = Letter[1];} } return true;} . The bot correctly answers for x y and z . It then answers V for all other letters, digits and short words What is the letter before cow answer: V Thank you for your time |