JavaScript - How To Convert Book Market To Function
I use a bookmarklet that looks like this:
Code: try{ sl_el_wrapper.go(); } catch(e){ var%20s=document.createElement('script'); s.id='sl_el_BMSCRIPT'; s.type='text/javascript'; document.body.appendChild(s); s.src='http://EXAMPLE.com/marklet.js.php?v='+(new%20Date().getTime()); } void(0); This was all on one line, but I added a return after each ;. I want to make this a function so I can click a button on my page and have it run. I've tried a lot of things but cant seem to make it work. Any thoughts? Similar TutorialsI am studying Javascript from the Headfirstlabs book. Please see my coding below as per the instructions on page 26, the only thing that happens is the onload alert [Hello, I am your per rock] when the page loads, nothing else and no touchrock function or smiling face, I have the images where they should be. Can anyone tell me why it's not working on my end please? Code: <html> <head> <title>irock -The virtual Pet Rock</title> <script type="text/javascript"> function touchrock () { var username = prompt ("What is your name?", "Enter your name here."); if (username) { alert ("It is good to meet you, " + username + "."); document.getElementByID ("rockImg").src = "rock_happy.png"; } } </script> </head> <body onload="alert ('Hello, I am your pet rock.');"> <div style="margin-top: 100px; text-align: center;"> <img id="rockIMG" src="rock.png" alt="irock" /> </div> </body> </html> Hello all, I'm looking for a Market stock bar similar to http://www.bloomberg.com/ I've been looking around and can't find any API's or examples. Could someone point me in the right direction? I'm trying to get the following function working Code: function jump(document_root, mode, cat, id, qs) { var response = confirm("Are you sure that you want to completely delete this record"); if(response) { var url = document_root+"/"+mode+"/"+cat+"/"+id+qs; window.location(url); return true; } else return false; } It called with the following Code: <a href="" onclick="jump('/tradedoubler_admin/web', 'Pages', 'Delete', '011' ,'');">Delete</a> But the redirect isnt working i get the following error : Code: Error: uncaught exception: [Exception... "Cannot convert WrappedNative to function" nsresult: "0x8057000d (NS_ERROR_XPC_CANT_CONVERT_WN_TO_FUN)" location: "JS frame :: http://192.168.1.99/tradedoubler_admin/web/scripts/pagejump.js :: jump :: line 7" data: no] Is any one familiar with this error? It's suppose to be a pop up box that asks if the user really want to delete this record, if he clicks yes it redirects to delete it, but if not it doesn't do anything. Hi there i wanted some sugessions on good books out there for AJAX as a whole for beginners familiar in programming. I donot know java scripting. Should i learn that before AJAX? Please suggest good books for both
So I am looking for a book that basically goes from the very basics to middle level of java programing, but one that is up to date, and that explains everything, not like some of the books that just throws code at you and expects you to understand why you are making the class public and why it extends javaplugins, just something in depth that really explains why for everything.
Hello, I was just wondering if anyone knows of a great javascript book to buy. I am looking for something super duper hard core. I would love it to have documentation galore that includes all of the AJAX and DOM and XML. You know... like a javascript BIBLE. Something thick and comforting. Something that makes you feel all warm and toasty inside just knowing that it is there. So if I start running into some problem I can just glance at the book and rest assured that if the problem exculates not to fear. I have .... THE BOOK. Does anyone have any suggestions? Thanks, Michael Hi, I have a very old book on JavaScript, and just wondering if it would be wise to start from it. The book is: SAMS Teach yourself JavaScript in 24 hours - Second Edition (covers JavaScript 1.5) Let me know guys because I can get cracking on with it if so! What I need to know is whether or not JS has been updated since? Would like to start learning JavaScript and would appreciate any books based on JavaScript that forum members would care to recommend. Thanks all
Hi, I'm looking for a coloring book script and ... I'm trying to understand, how does it work: http://www.coloringpageskids.org/onl...ls-butterfly,5 It's HTML5, JavaScript or something else? I have strings's that are causing problems when being sent to a PHP script via JavaScript. (not all of it is getting sent) i.e. This is someone's line of text & it's rather long. I wish to convert the whole string to some other format say like the spaces to %20 and and the & to & I think, and so on... Then once the PHP script $_GET's the string it converts it back to the original. PLEASE NOTE: I wish to use JavaScript, not JQuery. I have come to the conclusion that this book title sux "New Perspectives on JavaScript, 2nd Edition " Is there a better book I can use where I can copy the sample programs that the book uses, that actually has good modern javascript technique, and has the other code that goes along with it like the html, the css, and the .jpgs all on the cd that comes with the book or something? "Professional JavaScript for Web Developers (Wrox Programmer to Programmer)" by Nicholas C. Zakas is a good book title it definitely clarified that crappy text book that my university gave me, but I'm ready to take the next step and start using sample code and apply the concepts I learned from that book. Please recommend anything I would need to be ubber programmers like all of you guys.
AMAZON has some nice future for book preview and they can display book cover/back like real book. For instance Rational Astrology: as a physical model (Chinese Edition): Julian J.-L. Ting: 9781493734559: Amazon.com: Books Presumably that is done by javascript? Is there any free code available for doing such business? I have to take more javascript programming classes and I'm really not good at it. I desperately need help. I own Visual Basic, but it's a little difficult to use. What is the best book, online resource, and software for programming in javascript?
I typed this code straight out of the book and it just doesn't seem to work. I have the headlines on the left side and when clicked the contents of the headline is supposed to show up in the text box on the right. Well, needless to say, nothing appears. Please someone tell me what I am doing wrong. I am not the only person in the class having this issue. Thanks a million. Code: <!DOCTYPE HTML> <!--mwelborn--> <!--Chapter 8 Page 475--> <!--October 25, 2011 --> <html> <head> <title>News Items</title> <script type="text/javascript"> /* <![CDATA[ */ var newsItem1 = "L'AQUILA, ITALY (AP) - L'Aquila's chief prosecutor announced an investigation into allegations of shoddy construction as people sill missing after a devastating earthquake five days ago. http://in.reuters. com/article/ idUSWBT01103020090411; var newsItem2 = "WASHINGTON (Reuters) - President Barack Obama said on Friday the recession- hit US economy was showing 'glimmers of hope' despite remaining under strain and promised further steps in coming weeks to tackle the financial crisis. http://in.reuters.com/article. idUSWBT01103020090411"; var newsItem3 = "(eweek.com) - Apple is close to hitting 1 billion downloads from its App Store and plans on a prize giveaway fo whoever downloads the billionth application that includes a MacBook Pro and an iPod Touch. http://www.eweek.com/c/a/ Application-Development/eWeek-Newsbreak -April-13-2009/"; var newsItem4 = "ATLANTA (AP) - Chipper Jones drove in two runs, including a tiebreaking single, and the Atlanta Braves beat Washington 8-5 on Sunday to hand the Nationals their sixth straight loss to start the season. http://www.newsvine.com/_news/2009/04/11 2667835-jones-braves-beat-winless -nationals-8-5?category=sports"; /* ]] */ </script> </head> <body> <form name="newsHeadlines" action="" method="get"> <table style="border: 0; width: 100%"> <tr valign="top"> <td> <select name="newsHeadlines" multiple="multiple" style="height: 93px"> <option onclick="document.newsHeadlines .news.value=newsItem1"> Investigation of building standards in quake zone</option> <option onclick="document.newsHeadlines .news.value=newsItem2"> Obama sees signs of economic progress</option> <option onclick="document.newsHeadlines .news.value=newsItem3"> Apple App Downloads Approach 1 Billion</option> <option onclick="document.newsHeadlines .news.value=newsItem4"> Jones, Baves beat winless Nationals 8-5</option> </select> </td> <td> <textarea name="newsHeadlines" cols="50" rows="10" style="background-color: Transparent"></textarea> </td> </tr> </table> </form> </body> </html> See title How do i do it? Hi All, I'm fairly new to JavaScript and i'm just trying out my first few programs. I'm having an issue where I need to take a string, such as SAMPLE and add spaces between the letters to give S A M P L E So far I've taken the string and split it into an array so that each element holds a letter, however, when displaying the array iT comes seperated by commas. I can't simply ask for element 1 + <space> and so on because I'm creating a function to do this. The string to have spaces added to it could be any length. My function is addSpaces(aString) and it should give me a new variable as a string with the result. Has anyone come across this before?? Thanks a lot for your help! Any one can help how to convert the below PHP code to javascript code: class Mobile { public static function is_mobile(){ $user_agent = $_SERVER['HTTP_USER_AGENT']; // get the user agent value - this should be cleaned to ensure no nefarious input gets executed $accept = $_SERVER['HTTP_ACCEPT']; // get the content accept value - this should be cleaned to ensure no nefarious input gets executed return false || (preg_match('/ipad/i',$user_agent)) || (preg_match('/ipod/i',$user_agent)||preg_match('/iphone/i',$user_agent)) || (preg_match('/android/i',$user_agent)) || (preg_match('/opera mini/i',$user_agent)) || (preg_match('/blackberry/i',$user_agent)) || (preg_match('/(pre\/|palm os|palm|hiptop|avantgo|plucker|xiino|blazer|elaine)/i',$user_agent)) || (preg_match('/(iris|3g_t|windows ce|opera mobi|windows ce; smartphone;|windows ce; iemobile)/i',$user_agent)) || (preg_match('/(mini 9.5|vx1000|lge |m800|e860|u940|ux840|compal|wireless| mobi|ahong|lg380|lgku|lgu900|lg210|lg47|lg920|lg840|lg370|sam-r|mg50|s55|g83|t66|vx400|mk99|d615|d763|el370|sl900|mp500|samu3|samu4|vx10|xda_|samu5|samu6|samu7|sa mu9|a615|b832|m881|s920|n210|s700|c-810|_h797|mob-x|sk16d|848b|mowser|s580|r800|471x|v120|rim8|c500foma:|160x|x160|480x|x640|t503|w839|i250|sprint|w39 8samr810|m5252|c7100|mt126|x225|s5330|s820|htil-g1|fly v71|s302|-x113|novarra|k610i|-three|8325rc|8352rc|sanyo|vx54|c888|nx250|n120|mtk |c5588|s710|t880|c5005|i;458x|p404i|s210|c5100|teleca|s940|c500|s590|foma|samsu|vx8|vx9|a1000|_mms|m yx|a700|gu1100|bc831|e300|ems100|me701|me702m-three|sd588|s800|8325rc|ac831|mw200|brew |d88|htc\/|htc_touch|355x|m50|km100|d736|p-9521|telco|sl74|ktouch|m4u\/|me702|8325rc|kddi|phone|lg |sonyericsson|samsung|240x|x320|vx10|nokia|sony cmd|motorola|up.browser|up.link|mmp|symbian|smartphone|midp|wap|vodafone|o2|pocket|kindle|mobile|psp |treo)/i',$user_agent)) || ((strpos($accept,'text/vnd.wap.wml')>0)||(strpos($accept,'application/vnd.wap.xhtml+xml')>0)) || (isset($_SERVER['HTTP_X_WAP_PROFILE'])||isset($_SERVER['HTTP_PROFILE'])) || (in_array(strtolower(substr($user_agent,0,4)),array('1207'=>'1207','3gso'=>'3gso','4thp'=>'4thp','50 1i'=>'501i','502i'=>'502i','503i'=>'503i','504i'=>'504i','505i'=>'505i','506i'=>'506i','6310'=>'6310 ','6590'=>'6590','770s'=>'770s','802s'=>'802s','a wa'=>'a wa','acer'=>'acer','acs-'=>'acs-','airn'=>'airn','alav'=>'alav','asus'=>'asus','attw'=>'attw','au-m'=>'au-m','aur '=>'aur ','aus '=>'aus ','abac'=>'abac','acoo'=>'acoo','aiko'=>'aiko','alco'=>'alco','alca'=>'alca','amoi'=>'amoi','anex'=> 'anex','anny'=>'anny','anyw'=>'anyw','aptu'=>'aptu','arch'=>'arch','argo'=>'argo','bell'=>'bell','bi rd'=>'bird','bw-n'=>'bw-n','bw-u'=>'bw-u','beck'=>'beck','benq'=>'benq','bilb'=>'bilb','blac'=>'blac','c55/'=>'c55/','cdm-'=>'cdm-','chtm'=>'chtm','capi'=>'capi','cond'=>'cond','craw'=>'craw','dall'=>'dall','dbte'=>'dbte','dc-s'=>'dc-s','dica'=>'dica','ds-d'=>'ds-d','ds12'=>'ds12','dait'=>'dait','devi'=>'devi','dmob'=>'dmob','doco'=>'doco','dopo'=>'dopo','el49'= >'el49','erk0'=>'erk0','esl8'=>'esl8','ez40'=>'ez40','ez60'=>'ez60','ez70'=>'ez70','ezos'=>'ezos','e zze'=>'ezze','elai'=>'elai','emul'=>'emul','eric'=>'eric','ezwa'=>'ezwa','fake'=>'fake','fly-'=>'fly-','fly_'=>'fly_','g-mo'=>'g-mo','g1 u'=>'g1 u','g560'=>'g560','gf-5'=>'gf-5','grun'=>'grun','gene'=>'gene','go.w'=>'go.w','good'=>'good','grad'=>'grad','hcit'=>'hcit','hd-m'=>'hd-m','hd-p'=>'hd-p','hd-t'=>'hd-t','hei-'=>'hei-','hp i'=>'hp i','hpip'=>'hpip','hs-c'=>'hs-c','htc '=>'htc ','htc-'=>'htc-','htca'=>'htca','htcg'=>'htcg','htcp'=>'htcp','htcs'=>'htcs','htct'=>'htct','htc_'=>'htc_','haie'=> 'haie','hita'=>'hita','huaw'=>'huaw','hutc'=>'hutc','i-20'=>'i-20','i-go'=>'i-go','i-ma'=>'i-ma','i230'=>'i230','iac'=>'iac','iac-'=>'iac-','iac/'=>'iac/','ig01'=>'ig01','im1k'=>'im1k','inno'=>'inno','iris'=>'iris','jata'=>'jata','java'=>'java','kddi'=> 'kddi','kgt'=>'kgt','kgt/'=>'kgt/','kpt '=>'kpt ','kwc-'=>'kwc-','klon'=>'klon','lexi'=>'lexi','lg g'=>'lg g','lg-a'=>'lg-a','lg-b'=>'lg-b','lg-c'=>'lg-c','lg-d'=>'lg-d','lg-f'=>'lg-f','lg-g'=>'lg-g','lg-k'=>'lg-k','lg-l'=>'lg-l','lg-m'=>'lg-m','lg-o'=>'lg-o','lg-p'=>'lg-p','lg-s'=>'lg-s','lg-t'=>'lg-t','lg-u'=>'lg-u','lg-w'=>'lg-w','lg/k'=>'lg/k','lg/l'=>'lg/l','lg/u'=>'lg/u','lg50'=>'lg50','lg54'=>'lg54','lge-'=>'lge-','lge/'=>'lge/','lynx'=>'lynx','leno'=>'leno','m1-w'=>'m1-w','m3ga'=>'m3ga','m50/'=>'m50/','maui'=>'maui','mc01'=>'mc01','mc21'=>'mc21','mcca'=>'mcca','medi'=>'medi','meri'=>'meri','mio8'=> 'mio8','mioa'=>'mioa','mo01'=>'mo01','mo02'=>'mo02','mode'=>'mode','modo'=>'modo','mot '=>'mot ','mot-'=>'mot-','mt50'=>'mt50','mtp1'=>'mtp1','mtv '=>'mtv ','mate'=>'mate','maxo'=>'maxo','merc'=>'merc','mits'=>'mits','mobi'=>'mobi','motv'=>'motv','mozz'=> 'mozz','n100'=>'n100','n101'=>'n101','n102'=>'n102','n202'=>'n202','n203'=>'n203','n300'=>'n300','n3 02'=>'n302','n500'=>'n500','n502'=>'n502','n505'=>'n505','n700'=>'n700','n701'=>'n701','n710'=>'n710 ','nec-'=>'nec-','nem-'=>'nem-','newg'=>'newg','neon'=>'neon','netf'=>'netf','noki'=>'noki','nzph'=>'nzph','o2 x'=>'o2 x','o2-x'=>'o2-x','opwv'=>'opwv','owg1'=>'owg1','opti'=>'opti','oran'=>'oran','p800'=>'p800','pand'=>'pand','pg-1'=>'pg-1','pg-2'=>'pg-2','pg-3'=>'pg-3','pg-6'=>'pg-6','pg-8'=>'pg-8','pg-c'=>'pg-c','pg13'=>'pg13','phil'=>'phil','pn-2'=>'pn-2','pt-g'=>'pt-g','palm'=>'palm','pana'=>'pana','pire'=>'pire','pock'=>'pock','pose'=>'pose','psio'=>'psio','qa-a'=>'qa-a','qc-2'=>'qc-2','qc-3'=>'qc-3','qc-5'=>'qc-5','qc-7'=>'qc-7','qc07'=>'qc07','qc12'=>'qc12','qc21'=>'qc21','qc32'=>'qc32','qc60'=>'qc60','qci-'=>'qci-','qwap'=>'qwap','qtek'=>'qtek','r380'=>'r380','r600'=>'r600','raks'=>'raks','rim9'=>'rim9','rove'=> 'rove','s55/'=>'s55/','sage'=>'sage','sams'=>'sams','sc01'=>'sc01','sch-'=>'sch-','scp-'=>'scp-','sdk/'=>'sdk/','se47'=>'se47','sec-'=>'sec-','sec0'=>'sec0','sec1'=>'sec1','semc'=>'semc','sgh-'=>'sgh-','shar'=>'shar','sie-'=>'sie-','sk-0'=>'sk-0','sl45'=>'sl45','slid'=>'slid','smb3'=>'smb3','smt5'=>'smt5','sp01'=>'sp01','sph-'=>'sph-','spv '=>'spv ','spv-'=>'spv-','sy01'=>'sy01','samm'=>'samm','sany'=>'sany','sava'=>'sava','scoo'=>'scoo','send'=>'send','siem'=> 'siem','smar'=>'smar','smit'=>'smit','soft'=>'soft','sony'=>'sony','t-mo'=>'t-mo','t218'=>'t218','t250'=>'t250','t600'=>'t600','t610'=>'t610','t618'=>'t618','tcl-'=>'tcl-','tdg-'=>'tdg-','telm'=>'telm','tim-'=>'tim-','ts70'=>'ts70','tsm-'=>'tsm-','tsm3'=>'tsm3','tsm5'=>'tsm5','tx-9'=>'tx-9','tagt'=>'tagt','talk'=>'talk','teli'=>'teli','topl'=>'topl','hiba'=>'hiba','up.b'=>'up.b','upg1'= >'upg1','utst'=>'utst','v400'=>'v400','v750'=>'v750','veri'=>'veri','vk-v'=>'vk-v','vk40'=>'vk40','vk50'=>'vk50','vk52'=>'vk52','vk53'=>'vk53','vm40'=>'vm40','vx98'=>'vx98','virg'= >'virg','vite'=>'vite','voda'=>'voda','vulc'=>'vulc','w3c '=>'w3c ','w3c-'=>'w3c-','wapj'=>'wapj','wapp'=>'wapp','wapu'=>'wapu','wapm'=>'wapm','wig '=>'wig ','wapi'=>'wapi','wapr'=>'wapr','wapv'=>'wapv','wapy'=>'wapy','wapa'=>'wapa','waps'=>'waps','wapt'=> 'wapt','winc'=>'winc','winw'=>'winw','wonu'=>'wonu','x700'=>'x700','xda2'=>'xda2','xdag'=>'xdag','ya s-'=>'yas-','your'=>'your','zte-'=>'zte-','zeto'=>'zeto','acs-'=>'acs-','alav'=>'alav','alca'=>'alca','amoi'=>'amoi','aste'=>'aste','audi'=>'audi','avan'=>'avan','benq'=> 'benq','bird'=>'bird','blac'=>'blac','blaz'=>'blaz','brew'=>'brew','brvw'=>'brvw','bumb'=>'bumb','cc wa'=>'ccwa','cell'=>'cell','cldc'=>'cldc','cmd-'=>'cmd-','dang'=>'dang','doco'=>'doco','eml2'=>'eml2','eric'=>'eric','fetc'=>'fetc','hipt'=>'hipt','http'=> 'http','ibro'=>'ibro','idea'=>'idea','ikom'=>'ikom','inno'=>'inno','ipaq'=>'ipaq','jbro'=>'jbro','je mu'=>'jemu','java'=>'java','jigs'=>'jigs','kddi'=>'kddi','keji'=>'keji','kyoc'=>'kyoc','kyok'=>'kyok ','leno'=>'leno','lg-c'=>'lg-c','lg-d'=>'lg-d','lg-g'=>'lg-g','lge-'=>'lge-','libw'=>'libw','m-cr'=>'m-cr','maui'=>'maui','maxo'=>'maxo','midp'=>'midp','mits'=>'mits','mmef'=>'mmef','mobi'=>'mobi','mot-'=>'mot-','moto'=>'moto','mwbp'=>'mwbp','mywa'=>'mywa','nec-'=>'nec-','newt'=>'newt','nok6'=>'nok6','noki'=>'noki','o2im'=>'o2im','opwv'=>'opwv','palm'=>'palm','pana'=> 'pana','pant'=>'pant','pdxg'=>'pdxg','phil'=>'phil','play'=>'play','pluc'=>'pluc','port'=>'port','pr ox'=>'prox','qtek'=>'qtek','qwap'=>'qwap','rozo'=>'rozo','sage'=>'sage','sama'=>'sama','sams'=>'sams ','sany'=>'sany','sch-'=>'sch-','sec-'=>'sec-','send'=>'send','seri'=>'seri','sgh-'=>'sgh-','shar'=>'shar','sie-'=>'sie-','siem'=>'siem','smal'=>'smal','smar'=>'smar','sony'=>'sony','sph-'=>'sph-','symb'=>'symb','t-mo'=>'t-mo','teli'=>'teli','tim-'=>'tim-','tosh'=>'tosh','treo'=>'treo','tsm-'=>'tsm-','upg1'=>'upg1','upsi'=>'upsi','vk-v'=>'vk-v','voda'=>'voda','vx52'=>'vx52','vx53'=>'vx53','vx60'=>'vx60','vx61'=>'vx61','vx70'=>'vx70','vx80'= >'vx80','vx81'=>'vx81','vx83'=>'vx83','vx85'=>'vx85','wap-'=>'wap-','wapa'=>'wapa','wapi'=>'wapi','wapp'=>'wapp','wapr'=>'wapr','webc'=>'webc','whit'=>'whit','winw'=> 'winw','wmlb'=>'wmlb','xda-'=>'xda-',))) ; } } hello there.. I'm poor with javascript.. can you help me to convert this php to javascript? Code: <?php setcookie("KNwidget", "fbfans", time()+3600); ?> <?php if (isset($_COOKIE["KNwidget"])) echo "when has COOKIE, nothing show here.."; else echo "<script type='text/javascript'>some java script here</script>"; ?> I need some help converting my dates to dd/mm/yy from mm/dd/yy? can someone please help Code: <script type="text/javascript"> $(function() { var dates = $( "#from, #to" ).datepicker({ defaultDate: "+1w", changeMonth: true, numberOfMonths: 3, onSelect: function( selectedDate ) { var option = this.id == "from" ? "minDate" : "maxDate", instance = $( this ).data( "datepicker" ), date = $.datepicker.parseDate( instance.settings.dateFormat || $.datepicker._defaults.dateFormat, selectedDate, instance.settings ); dates.not( this ).datepicker( "option", option, date ); } }); }); </script> <label for="from">From date</label> <input type="text" id="from" name="from"/> <label for="to">to date</label> <input type="text" id="to" name="to"/> How do I do this equivalent function in javascript? Code: int x = 0; int y = 1; convertBool(x); convertBool(y); private void convertBool(obj) { bool rtnB = Convert.ToBoolean(obj); string TorF = (!obj) ? "true" : "false" ; Console.WriteLine(TorF); } // code would output // false // true I am trying to pass a bit by my function call Code: function fxn(obj){ document.getElementById('box').style.display = (!obj) 'block' : 'none' ; } code somewhere else... onmouseover="fxn(1);" onmouseout="fxn(0)" I know I could do it via if obj != 0 or if obj == 0 but I want to be able to convert the bool- I know how to do it other ways but if js does not support a "one liner" I will do it via int compare |