SEARCH YOUR SOLUTION HERE  

Javascript newbie help!

quick question, I am a newbie, first with this site, and with programming. this is my first semester and I am learning the basics. I am having a problem with Javascript. this simple code is supposed to just create a web page with the tile , my name and then I am supposed to add text to the page (using astericks), according to the visitor input information. I have the code working to the point of asking which object (right trangle, left triangle, isoceles triangle or rectangle), I have it then alerting the question about the height of the object, (the while loop i have in there set to give an invalis response it working well, the problem I have it getting the actual text on the page in the shape of the object as astericks, anytime I use the document.write(), i get a number (from the user) that screams across the page and gives me a scriptting error. This is probably something simple, dont laugh too hard. O have tried several different ways and used the w3schools website for more info and cant seem to get this to work. any suggestions, maybe another website with more examples.

Posted On: Sunday 25th of November 2012 09:59:43 PM Total Views:  226
View Complete with Replies




Related Messages:

newbie : javascript virual keyboard   (270 Views)
I am a java developer, just started to learn javascript, where can I find an easy example for doing this : http://kbjs.herokuapp.com/
newbie : javascript virual keyboard   (89 Views)
I am a java developer, just started to learn javascript, where can I find an easy example for doing this : http://kbjs.herokuapp.com/
newbie: constants in JavaScript   (98 Views)
, I am learning JavaScript and I have a question concerning constants in JavaScript: Why JSLint (http://www.jslint.com/) reports error on the following code: const reEmail = /^[a-z0-9-.]{1,40}@[a-z0-9-.]{1,70}$/; const reDate = /^(\d{4})(\/|-|\.)(\d{1,2})(\/|-|\.)(\d{1,2})$/; var error_message; var focus_on; function getElementValue(elem) { if (elem.tagName == 'input' && elem.length) for (var i = 0, len = elem.length; i < len; i++) if (elem[i].checked) { elem = elem[i]; break; } return elem.value; } .... JSLint reports: Problem at line 1 character 1: Expected an identifier and instead saw 'const'. const reEmail = /^[a-z0-9-.]{1,40}@[a-z0-9-.]{1,70}$/; Problem at line 1 character 7: Stopping, unable to continue. (0% scanned). Is the syntax I use correct If not, how to write it Please help. Thank you!
Resolved newbie question --- wholesale row color change   (152 Views)
Easier to show than to explain: Code: function check(field) { for (i = 0; i < field.length; i++) field[i].checked = true ; } function uncheck(field) { for (i = 0; i < field.length; i++) field[i].checked = false ; } Choice CA Choice CB Choice CB never touched should be yellow. checked should have white background. unchecked should have cyan background. How do I get 'Check ' and 'Uncheck ' to obey the tr background color, too
Coding newbie needs help with a "calculator"   (96 Views)
, I've just joined up because I need some help. I'm just learning html, css, and javascript in a class so I don't know all too much. What I'm trying to do right now is create a function that I can calculate a number with. There would be a blank "form" line where the person could enter a number(let's say 5000). Then there would be another "form" line where the person could enter a percentage(let's say 10% or .1). Then there would be a button that the person could click that would pop up an alert reading off what the answer would be(500). In an ideal world the second form line would be a drop down list and whatever is chosen would have a percentage tied to it that would be used when multiplied(I guess this would be more like a variable) This is for a project where the best website in the class gets an automatic A and does not have to take the final exam, so I'm really trying to impress. I have no idea where to start, so I'd appreciate any help I can get.....if it's possible that is.
I am a newbie please help   (106 Views)
Hi ! I want to delete all nodes, but leave one div in my html. var p = document.getElementById('container'); var leave= document.getElementById('leave_this'); while (p.hasChildNodes()) { if(leave != p.childNodes){ p.removeChild(p.firstChild); } } Please help. Cheers
Not understanding/First attempt/way newbie   (153 Views)
I had code that I tried to recycle by changing the math function. I want to square the number in the first column and output the results in the second column. I would also like to add a row on the bottom of each column and a function that would output the sum of each column into that row. I am totally lost. Any help would be greatly appreciated. This is the code I have. Unit 4 Table #newtable{ border:5px solid red; font-family:sans-serif; font-size:18px; margin:auto; } #newtable td{ width:50px; line-height:50px; border:3px solid blue; text-align:center; } window.onload=function() { makeTable(); } function makeTable() { row=new Array(10); cell=new Array(2); row_num=10; cell_num=2; tab=document.createElement('table'); tab.setAttribute('id','newtable'); tbo=document.createElement('tbody'); for(c=0;c
newbie javascript question - customising ckeditor using cakephp   (132 Views)
hello all I'm trying to get the textarea text editor plugin CKEditor to work on my project. I'm using cakephp and following this simple tutorial amilan.wordpress.com/2010/01/28/ckeditor-integration-in-cakephp which basically tells that once I've included jquery and ckeditor then all I need to do to create a ckeditor textarea is: echo $form->textarea('content', array('id'=>'content','class'=>'ckeditor')); That all works fine except I can't resize the textarea at all. I've tried with css and putting 'cols' and 'rows' in there but to no avail. When I remove the ckeditor class it does work so I think it's something to do with the config. There is a config.js file which you can fiddle with but I don't know enough to know what to do to alter the height and width. Can anyone help me The relevant bit of the documentation is http://docs.cksource.com/CKEditor_3....Configurations
I'm a newbie... Please help   (186 Views)
I am trying to learn how to use radio buttons in javascript without using functions. This is what I did but it does not work: var season3pointer = "Ray en" if (season3pointer == Ray en) { alert("Good Answer"); } else { alert("You don't know anything about the Celtics") } document.write(""+""+"Who has the record for most 3 points made in a game"+ ""+""+season3pointer+ "Antoine Walker"+""); I know it should be very easy, but so far I have only found how to do it using functions, any help truly appreciated.
js literal expression help. newbie   (117 Views)
I need to find a way to check if a field contains sql commands. To begin with, lets just say as an example:select, delete, drop, truncate function validate () { var literals= /select/; user_input = document.forms[0].input1.value.search(literals); if (user_input == -1) { alert("test123"); } } I am new to JS and regular experssions. How do I make it in my regular expression so not only am I searching for /select/ but also for the other sql commands (or anythign for that matter)... essentially multiple literals... eg if it contains /select OR delete OR truncate/ etc. sorry if this is confusing. let me know if i can help in any other way.
Objects, functions and drawing (newbie question)   (230 Views)
Hi Everyone I am trying to write some code to create an object in JS that contains the x,y coords for a shape i wish to draw. I create the shape, and then in a draw function I draw the shape to the screen from the object I created erlier. Trouble it is does not seem to work :S have anyone got and ideas Code: var myShape = new newShape(200,200); function init() { canvas = document.getElementById("canvas"); ctx = canvas.getContext("2d"); return setInterval(draw, 50); } // init function newShape(x,y){ this.un_X=x this.un_Y=y function draw() { ctx.beginPath(); ctx.arc(un_X,un_Y,30,0,Math.PI*2,true); ctx.closePath(); ctx.stroke(); } // draw } // newShape function draw() { ctx.clearRect(0, 0, WIDTH, HEIGHT); myShape.draw(); } // draw init();
Slideshow timings (newbie question)   (135 Views)
Hi I'm trying to get a slideshow working but the timings are all over the place. I can make it loop through once, neatly, but thereafter the timings seem to out - I have a loop set up to run five times. I think this is because the function is incrementing the delay values or something along those lines (I know there's a neater way to write this but I'm just starting out). Code: function slideWinder () { var x = 1 for (var x = 1; x < 5; x++) { $('#slideone').delay(0).fadeIn(0).delay(2000).fadeOut(400); $('#slidetwo').delay(2000).fadeIn(400).delay(2000).fadeOut(400); $('#slidethree').delay(4000).fadeIn(400).delay(2000).fadeOut(400); $('#slidefour').delay(6000).fadeIn(400).delay(2000).fadeOut(400); $('#slidefive').delay(8000).fadeIn(400).delay(2000).fadeOut(400); $('#slidesix').delay(10000).fadeIn(400).delay(2000).fadeOut(400); } }
newbie needs cookie help   (257 Views)
! Ok here is what I m trying to do: collect data from an html form and create a cookie containing that data, then have that cookie auto complete the form the next time someone returns to the site. Where I m at: Well unfortunately I m still stuck on getting the form data into the cookie. I cant seem to get the cookie to see the form data, the output is driving me crazy. What should be: "Your name is: your name" is returning as: "Your name is: [object]" The code: Ok so I m working on two pages one is writecookie.html and the other is readcookie.html Due to my continuing frustration I went back to the bare bones of the code and took out all extraneous lines, so this isn t even a real world example of what I m trying to do. I figure, if I can make this example work then I can carry over the solution to my actual application. --->writecooie.html Untitled Document readcookie.html Untitled Document function readCookie() { var the_cookie = document.cookie; var the_cookie = unescape(the_cookie); var broken_cookie = the_cookie.split(":"); var the_name = broken_cookie[1]; alert("Your name is: " + the_name); } What I've tried: Ok, from the code you can see I m using the Javascript DOM to reference the path to the text field in the form document.formname.formfield in this case: document.cookie_form.name other paths I have tried; document.cookie_form.name.value, doucument.cookie_form.name.text, document.cookie_form.value, window.document.cookie_form.name, document.cookie_form.elements[0].value, and document.cookie_form.elements[0] Im sure there have been others but I dont recall them right now If you can help, I would really appreciate it. Garrik
help newbie here   (199 Views)
What does this function means. contentEl : 'av',
JS newbie help again   (159 Views)
I'm in need of some more help for something quite simple. I'm trying to get to work is the (onmouseover) portion of the below. I'm sure there is a typo somewhere that I'm not seeing. I've got to quit doing homework when I'm exhausted. Just a little hard after working 12 hour shifts six days a week for the last six months.
HTML newbie problem!!   (164 Views)
Hi everybody I have one question. Im quite new to HTML programming, but have been dabbling with it. I have a website that has two dropdownlists (ASP.NET controls). One ddl is filled on Page_Load with the months available. The other I have filled with every week of the corresponding month with JavaScript. This has worked fine. I however get into trouble when continuing on. When I press my ASP.NET button and want to get the values in the dropdownbuttons I get the value for the one filled by ASP.NET but not the one filled by JavaScript. That one always reports 0 items, even though the items are shown on the webpage. How can I get the HTML values of the dropdown server side with regards Arnar Gudnason Iceland
Urgently need help!!!   (172 Views)
Can anyone send me a simple, understandable javascript code for form validation, including e-mail validation,name validation , password validation etc. pls! send me in hurry!!!:'(
help!   (163 Views)
, Here's what I'm interested in doing but can't get working. In my webpage, the user can visualize some information from the database and eventually choose to edit it. ( this is done with AJAX). When the user clicks on "edit" the appropriate section is refreshed such that the aforementioned information appears in a text input and can now be modified by the user. What I would like to do next, is to take this modified information, associate it with a new variable and send it to the database to replace the old information - this is done after clicking a "save" button. (Again done with AJAX). However I'm having difficulties with this as I do not know how to associate the new information from the text input to a new variable. Perhaps there is a more intelligent way Any ideas are welcome! Best from Brussels, TMT000
designer seeking help with javascript menu   (177 Views)
I'm a graphic designer with very little HTML knowledge who has inherited the maintenance of non-profit agency's website. They have javascript drop-down menus as the part of their main navigation. Up until now, I've only had to change the text or change the size of the menus. But now, they've asked me to add a new menu to one of the buttons. I was hoping it would be simple "copy & paste" of the following code to create a new menu but I've tried it and it is isn't working. My guess is that it has something to do with the 'mm_menu_0623105927_3' but I really have no idea. Can someone shed some light window.mm_menu_0623105927_3 = new Menu("root",140,24,"Arial, Helvetica, sans-serif",10,"#ffffff","#ffffff","#ff9900","#ffc700","left","middle",5,0,1000,1,-1,true,false,true,0,false,true); mm_menu_0623105927_3.addMenuItem("FORMS & APPLICATIONS","window.open('downloads/forms.htm', '_self');"); mm_menu_0623105927_3.addMenuItem("MEDIA","window.open('downloads/media.htm', '_self');"); mm_menu_0623105927_3.hideOnMouseOut=true; mm_menu_0623105927_3.menuBorder=0; mm_menu_0623105927_3.menuLiteBgColor='#ffffff'; mm_menu_0623105927_3.menuBorderBgColor='#ffffff'; mm_menu_0623105927_3.bgColor='#ffffff'; The live site is at http://www.jcyc.org . (They want me to add a menu to the 'Contact Us' button) Thank you in advance., I assume that u have ur if statement and return function to where ever site ur editing, What I suggest u do for now is to change the last digit of ur submenu\MenuItem.... That is (eg.) in ur case if the last digit of downloads is 3 then for contact us u changed it to 4 U can try this and see if its gona work window.mm_menu_0623105927_4 = new Menu("root",140,24,"Arial, Helvetica, sans-serif",10,"#ffffff","#ffffff","#ff9900","#ffc700","left","middle",5,0,1000,1,-1,true,false,true,0,false,true); mm_menu_0623105927_4.addMenuItem("The menu u want to add","window.open('Contact Us/forms.htm', '_self');"); mm_menu_0623105927_4.hideOnMouseOut=true; mm_menu_0623105927_4.menuBorder=0; mm_menu_0623105927_4.menuLiteBgColor='#ffffff'; mm_menu_0623105927_4.menuBorderBgColor='#ffffff'; mm_menu_0623105927_4.bgColor='#ffffff';
Please help!!   (170 Views)