JavaScript - How Do I Write The Pseudo And Javascript Code For This?
how do i write a recursive program to calculate the factorial of a number between 0 and 6.if the user enters a number greater than 6 you should prompt the user again to input another number or -1 to exit the program.how do i write the pseudo code and the javascript code for this program?
i have no idea of how to do this and have been trying to figure it out since the last hour Similar Tutorialswrite a function that when called will ask the user for a series of numbers to be entered 1 at a time and then calculates their sum,their average,and their average rounded up then output the results. for example the average of a series of numbers is found by adding the numbers together and dividing by the amount of numbers entered (so the average of 2,5,1 and 7 is equal to (2+5+1+7)/4=15/4=3.75). JavaScript code responsive quiz I live in turkey. Can you write me such a code for my site? Hello, I used to own a book that explained an approach to coding, but I lost the book, cannot remember the author or title, plus I have only recently returned to coding and I have half forgotten the method the book taught It was brilliant as it used a system of non-language specific psuedo code in order to structure the solution to coding problems before actually coding in the language of choice Before moving on to JavaScript, I used to code Lingo/Director projects. Before finding this book, I used to struggle when attempting intermediate+ problems as I found it difficult to organise a clear approach before coding, so I just used to dive in there (which is bad). After finding the book, I found it quite easy to create a psudo code solution to most coding problems then, using this structured psuedo code as a guide, it was quite simple to code the structured psuedo code solution in the chosen language I have tried Amazon etc and although they have some books on structured programming, they are not the book I had and I get the sense that what they mean by structured programming is different to what the book I had actually taught I was hoping that someone on this forum might have used the same book, or knows what I mean and knows of a book or website that explains structured programming techniques It would be a great help to me if I could find this information again and I think it would be of great benefit to others on here - especially beginner javascripters like myself Thank you So im working on a case where I need to make a random ad pop up every time I refresh that web page. I've got all the steps down except to where I need to insert a command to write the text to the document. *Insert a command to write the following text to the Web document: Code: <a href="URL"> <img src="adn.jpg" alt="description" /> </a> where URL is the value of the rLink variable, n is the value of the rNumber variable, and description is the value of the rAD variable. what I have so far (all steps completed) is Code: <script type="text/javascript"> var rNumber= randInt(5);// generate a random integer from 1 to 5. var rAd= adDescription(rNumber);// description of the random ad. var rLink= adLink(rNumber);// URL of the random ad. document.write('<a href'"+rLink+"'><img src="ad'+rNumber+'.jpg" alt="'+rAd+'"/></a>'); </script> the bolded is the question, I know some quotes are out of order but I cant figure out which. any help would be appreciated how can I write on a picture with javascript? I need javascript to read height of an static multiline text and write height value into the var value? Is it possible? Hi everyone. I do all of my writing and editing in notepad but can't figure out how to use characters from different charsets in the same script-block. For example if I wanted to write Code: if ( CharInput=="ش" ) { N = 1;} if ( CharInput=="厜" ) { N = 2;} I've found the unicode the number for ش is 0634 and 厜 is 539C. But I don't know how to use them. My question is how do I modify the above piece of code so it works in something like notepad? I can't cut and paste them in because in plain text files like that of notepad the formating is lost and I'm pretty sure html wouldn't allow that anyway. Thanks for reading I have am currently taking over as the developer for this web site, and the developer who left the project unfinished wrote a script. What it does is takes posts from vBulletin forums, for instance News posts, and then it grabs the posts by ID and Title and writes the title on the home page of the web site. The problem right now that I have is the test wraps, you can see what I mean here http://www.netcodeilluminati.com/v2 If you look on the left, I want to make the text cut off after a certain amount of characters with "..." at the end as if there is more to the title but you can't see it. Here is the script: for (x = 0; x < 5; x++) { document.write("<li><div class=\"li_icon\"><img src=\"images/icons/text.png\" alt=\"text\" /></div><div class=\"li_text\">"); document.write("<a href=\"../forums/showthread.php?t="+threads[x].threadid+"\">"+threads[x].title+"</a></div></li>"); } I was wondering how I could go about doing this. Thanks for any future help. -Kevin Is it possible to use JavaScript to locate all of the "smiley sad Icon.jpg"'s and output the location within the table? Such as A3, and B2. Thank you in advance. Code: <html> <body> <table width="200" border="1"> <tr Id="A"> <td Id="1"><img src="http://www.hencam.co.uk/hencam_forum//extensions/Smile/tango/face-smile.png"> </td> <td Id="2"><img src="http://www.hencam.co.uk/hencam_forum//extensions/Smile/tango/face-smile.png"></td> <td Id="3"><img src="http://www.iconeasy.com/icon/thumbnails/System/Icons%20for%20Developers/smiley%20sad%20Icon.jpg"></td> </tr> <tr Id="B"> <td Id="1"><img src="http://www.hencam.co.uk/hencam_forum//extensions/Smile/tango/face-smile.png"></td> <td Id="2"><img src="http://www.iconeasy.com/icon/thumbnails/System/Icons%20for%20Developers/smiley%20sad%20Icon.jpg"></td> <td Id="3"><img src="http://www.hencam.co.uk/hencam_forum//extensions/Smile/tango/face-smile.png"></td> </tr> <tr Id="C"> <td Id="1"><img src="http://www.hencam.co.uk/hencam_forum//extensions/Smile/tango/face-smile.png"></td> <td Id="2"><img src="http://www.hencam.co.uk/hencam_forum//extensions/Smile/tango/face-smile.png"></td> <td Id="3"><img src="http://www.hencam.co.uk/hencam_forum//extensions/Smile/tango/face-smile.png"></td> </tr> </table> </body> </html> Without elaboration plz see my code: Code: <body> <script> var b="s"; </script> <button target="_blank" onclick="window.open('http://......php?b="javascript:document.write(b);"&id=2&q=<?php print $_GET['q']; ?>','1','');return false;">xyz</button> </body> i don understand why this javascript:document.write(b); doesnt work in url... i know its simple yet it make my hair out of my head. plz count it.. Hi Everyone, I must admit that I'm a newbie in writing javascript. Can anyone help me with a script that will enable me to display a flash movie on one of my sites. I will appreciate all your responses. Thank you. I've written the following html, <html> <head> <script type="text/javascript"> function createpage(){ var first = document.getElementById('first').value var second = document.getElementById('second').value var third = document.getElementById('third').value var j = window.open('random'); var new_page = '<html><head><script type="text/javascript">function open_win() { window.open(first) window.open(second) window.open(third) } </script></head><body onLoad = "open_win()"></body></html>'; j.document.write(new_page); j.document.close(); } </script> </head> <body> <form action=""> <p> First Link: <input type="text" id="first" name="first"/> Second Link: <input type="text" id="second" name="second"/> Third Link: <input type="text" id="third" name="third"/> <input type=BUTTON value="Submit" name="mySubmit" onClick="createpage();return false;"> </p> </form> </body> </html> With the intention to eventually implement it into a website that "mashes" several URLs together into a tinyurl that, upon being opened, creates several tabs of the content the creator wanted in the single URL. Does that make sense? In order to best do this I figured a page with a random character string (I haven't yet implemented this part, for now 'random' holds the place of the new page/link) would have to be created that would launch all the tabs and then close itself. Here's what it should do... 1) User enter 3 URLs into three forms: First Link: <input type="text" id="first" name="first"/> Second Link: <input type="text" id="second" name="second"/> Third Link: <input type="text" id="third" name="third"/> 2) User clicks Submit button that calls "createpage()" function that's declared in the <head>er. The first part of this function declares the links that were inputted as variables first, second, and, third. <script type="text/javascript"> function createpage(){ var first = document.getElementById('first').value var second = document.getElementById('second').value var third = document.getElementById('third').value 3) "createpage()" function then declares a new window named 'random' to variable j (I have random.html stored in the same folder as this project. It is empty.) var j = window.open('random') 4) Next "createpage()" creates a variable that stores a full page's html code that includes a script that launches each link individually with window.open(). var new_page = '<html><head><script type="text/javascript">function open_win() { window.open(first) window.open(second) window.open(third) } </script></head><body onLoad = "open_win()"></body></html>'; 5) "createpage()" writes the code (stored in variable 'new_page') to document 'random' with j.document.write(new_page); 6) "createpage()" closes the document. Hello: I have two input boxes on a form which receive the first and last name of a user. I want to be able to use charAt() to get the first letter in each box and pass it to a third box on the same form. Is this doable? May I request some help? I was thinking something like the function below would be the starting point --I stand correct, as it is not working. Code: <script type=\"text/javascript\"> var str=\"Mossa\"; <!--document.write(str.charAt(0));--> document.write('<INPUT TYPE=text size=2 VALUE=\"str.charAt(0);\">'); var str=\"Barandao\"; document.write('<INPUT TYPE=text VALUE=\"str.charAt(0)\">'); <!--document.write(str.charAt(0));--> </script> Any thoughts! Mossa Hello, I use a iplocator api, which is javascript and gives out the city name, country and zipcode output PHP Code: <script language="JavaScript" src="http://www.somesite.com/somefile.js?key=apikey"></script> <script language="JavaScript"> <!-- document.write(ip2location_isp() + ', ' + ip2location_city() + ', ' + ip2location_zip_code() + ', ' + ip2location_net_speed()); //--> </script> my question or where i need help is that, i would like to output each of those as a hidden text field, so later i can store into mysq database with POST method from the hidden field. thank you in advance for your time n help If the value is negative it should be in red, otherwise it should be in green. It looks like JavaScript completely ignores the css class. Help please. Code: <html> <head> <title>Prva</title> <style type="text/css"> span.Pozitivno { color:green; font-weight:bold; } span.Negativno { color:red; font-weight:bold; } </style> <script type="text/javascript"> function vpisi_stevila() { var a; var b; //Vnos spremenljivk a=prompt("Vnesi stevilo a:") b=prompt("Vnesi stevilo b:") a=a*1 //S tem spremenimo string v int b=b*1 //Izpis stevil if(a<0) { document.write("A:<span class='Negativno'> " + a + " </span> <br />"); } else { document.write("A:<span class='Pozitivno'> " + a + " </span> <br />"); } if(b<0) { document.write("A:<span class='Negativno'> " + a + " </span> <br />"); } else { document.write("A:<span class='Pozitivno'> " + a + " </span> <br />"); } document.write("Vsota:", a+b, "<br />"); document.write("Razlika:", a-b, "<br />"); document.write("Mnozenje:", a*b, "<br />"); document.write("Deljenje:", a/b, "<br />"); document.write("Ostanek:", a%b, "<br />"); if(a>b) //Ce je A vecje od B { document.writeln("A je <b>večje </b> od b") } if(a<b) //Ce je B vecje od A { document.writeln("A je <b>manjse </b> od b") } if(a==b) //Ce sta enaka { document.writeln("A je <b>enako </b> b") } } </script> </head> <body onload="vpisi_stevila()"> </body> </html> I'm working on a website that will basically embed a widget/frame sent by a handler into a user's current page. The user basically adds a script tag to where they would like the HTML to be. The script tag has their settings and is basically a document.write that calls all the code that we want displayed. So here's my problem. We have a map that we need to add in a specific section, and to get the map we have to call another script tag. So we end up having a script tag (map) embedded in another script tag (the code for the widget/frame) or we end up having to document.write inside a document.write. Now this works just fine and as expected in Firefox, Safari, and Chrome. However, Internet Explorer and Opera wait until the first document.write is completely finished before calling the embedded one. Of course the problem with this, is that it takes the map out of the document's flow and just appends it to the bottom left of the page. Since the rest of the page has already been called, there's no way to move the interior "map" script. Any ideas? Basically just trying to figure out how (if even possible) to render an embedded script tag in Internet Explorer and be able to place it properly. I've tried everything that I can think of, including AJAX and Google's unescape script. Any suggestions, I'd greatly appreciate it. Or even if you've encountered a similar problem, and know that it just isn't possible in IE or Opera, that would be fine too. Thanks in advance! I'm trying to get a drop down box to change the image i've managed to get it working for one but can't seem to get it working when both scripts are on. any help would be much appreciated! http://humza-productions.co.uk/test/ this is the code i'm using, it's for the baseball jacket one but the one that's working live on the website is currently working for the hoodie Code: <script type="text/javascript"> window.onload=function() { bp='images/', //base url of your images imgnum=3, //Number of your images. This should match on your comboboxes options. thumb=document.getElementById('sho1'), //id of your image that will be changing combobox=document.getElementsByName('os1')[0]; // id of your combobox. combobox.onchange=function() { thumb.src=bp+'shop'+this.value+'.png'; } } </script> Hi all, Can some body help me i need a textbox and submit button.when i enter date in text box and click on submit button.Then my chart should display by passing my date(dynamic) through the code. how to design and code. Thanks.. Hi there, I'm sure someone can help me with this simple fix. I am putting a site together for a friend and I found a Javascript code that I'm using which basically causes an image to enlarge on mouse rollover. The website, which I just started, is: Home 2 What I'm trying to do is get the larger image to appear a little more to the right than it currently does, so it is not right on top of the thumbnails. I hope someone can tell me what code (and where) I need to add to accomplish this. I'm quite new at this so I really need specific instruction. Thanks in advance for your help! Here is the code for the onmouseover routine: Code: <head> <script language="JavaScript"> function showlargeimage(imgshow) {document.getElementById('image').src=imgshow;} function showlargeimage(imgshow) {document.getElementById('image').src=imgshow; document.getElementById('image').style.display='block'; } </script> </head> <body> <TABLE> <TR> <TD> <!--THUMBNAILS--> <img src="thumbnail1.jpg" onmouseover=showlargeimage('image1.jpg')><br> <br> <img src="thumbnail2.jpg" onmouseover=showlargeimage('image2.jpg')><br> <br> <img src="thumbnail3.jpg" onmouseover=showlargeimage('image3.jpg')><br> <br> <img src="thumbnail4.jpg" onmouseover=showlargeimage('image4.jpg')><br> <br> <img src="thumbnail5.jpg" onmouseover=showlargeimage('image5.jpg')><br> <br> </TD> <TD> <!--image SCREEN--> <img src='#' id='image'> <img src='#' id='image' style='display:none'> </TD> </TR> </TABLE> </body> |