JavaScript - Js Graphics Coding Requirement
Folks, I have been in IT for many years, but completely new to javascripting and ajax etc. I develop web sites and the php, html coding etc is no issue, its just that I have never needed to do any javascript coding and therefore have not used it at all.
Picking it up should present little problem, but as of this moment, I am a complete tyro, and I need to get moving on this requirement ASAP. I have a requirement which I haver never before needed to address. I would be grateful for some pointers to resources (I have searched and searched..... ) which I could use to develop the functionality I need. After that rambling intro, here is the actual issue..... I need to have a variety of areas on a single picture on the website, each of which if clicked on, will go to a different article. Rather than try to explain, here is a link which does a similar thing, although this one is in Flash (which I also don't know): http://www.comcare.gov.au/virtual_wo...fice/reception I need to do pretty much the same thing, though with a different picture and words of course. The website will be a Joomla based site. I hope I have gived enough information, and indeed, hope that I have posted to the right area! Any assistance or thoughts at all would be greatly appreciated. regards to all, Mike Similar TutorialsRequirements: i Each membership type selected is $20 per month (ie, if all 4 are selected then the monthly program fee is $80) ii if the membership is for 12 months then a 10% discount is applied to the program fee iii a 50% discount is to be applied to the program fee if the applicant is a UTT Student iv a 25% discount is to be applied to the program fee if the applicant is a UTT Staff member v a 15% discount is to be applied to the program fee if the applicant is either a Senior or Student from another school or university Here is what i have done..can you help me with it? Code: <?xml version= "1.0" encoding= "UTF-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtm… <html xmlns= "http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <script type="text/javascript"> total = 0; function ShowPFee(obj) { var price; var i; if (obj.checked) //user must have selected the box total = total + eval(obj.value); else //user must have DEselected the box total = total - eval(obj.value); document.getElementById("gymForm").P… = total; return; } function ShowPFee1(obj) { var df = document.forms["gymForm"], total = 0; var gym = df.MembershipType1, GroupFitness = df.MembershipType2, boxing = df.MembershipType3, tk = df.MembershipType4, months = df.MembershipTerm, pf = df.ProgramFee; if(gym.checked) {total = gym.value * eval(obj.value);} pf.value = total; if(GroupFitness.checked) {total = GroupFitness.value * eval(obj.value);} pf.value = total; if(boxing.checked) {total = boxing.value * eval(obj.value);} pf.value = total; if(tk.checked) {total = tk.value * eval(obj.value);} pf.value = total; return } </script> <link rel="stylesheet" type="text/css" href="practical2.css" /> <title> practical work online gym Form</title> </head> <body> <form name="gymForm" id="gymForm"> <p><b> Membership Type:</b> <input type="checkbox" name="MembershipType1" value="20" onclick="ShowPFee(this)" class="check-1" /> Gym <input type="checkbox" name="MembershipType2" value="20" onclick="ShowPFee(this)" class="check-2" /> Group Fitness <input type="checkbox" name="MembershipType3" value="20" onclick="ShowPFee(this)" class="check-1" /> Boxing <input type="checkbox" name="MembershipType4" value="20" onclick="ShowPFee(this)" class="check-2" /> Taekwondo </p> <p><b> Membership Category:</b> <input type="radio" name="MembershipCategory" value="Uws-Student" class="check-1" /> UTT Student - Student No: <input type="text" name="StudentNo" style="color:black; background-color:white" /> <input type="radio" name="MembershipCategory" value="UTT Staff" class="check-1" /> Uws Staff <input type="radio" name="MembershipCategory" value="Senior" /> Senior <input type="radio" name="MembershipCategory" value="General Public" class="check-1" /> General Public <input type="radio" name="MembershipCategory" value="Student other School/University" /> Student other School/University </p> <p><b> Membership Term: </b> <input type="radio" name="MembershipTerm" value=1 class="check-1" onclick="ShowPFee1(this)" /> 1 Month<input type="radio" name="MembershipTerm" value=6 class="check-2" onclick="ShowPFee1(this)" /> 6 Months <input type="radio" name="MembershipTerm" value=3 class="check-1" onclick="ShowPFee1(this)"/> 3 Months <input type="radio" name="MembershipTerm" value=12 onclick="ShowPFee1(this)" /> 12 Months i'm using a shopping cart template and i do NOT want to require that shoppers have to enter their email address. how do I disable the requirement, but still ensure if they do type it in, that the format is correct (i.e. person@website.com)? thanks! PHP Code: <?php if(! is_array($alladdresses)){ ?> if(frm.email.value==""){ alert("<?php print $xxPlsEntr?> \"<?php print $xxEmail?>\"."); frm.email.focus(); return (false); } validemail=0; var checkStr = frm.email.value; for (i = 0; i < checkStr.length; i++){ if(checkStr.charAt(i)=="@") validemail |= 1; if(checkStr.charAt(i)==".") validemail |= 2; } if(validemail != 3){ alert("<?php print $xxValEm?>"); frm.email.focus(); return (false); } hey guys i have graphic on the right side of the screen that is not in view and i am scrolling it to the left. Is there away to remove the bottom scrollbar permanently through using a mask or something. if i have an item scrolling from the left the scroll bar does not show, but on the right it does. an help be appreciated. I am looking to create a Stylesheet for YouTube, to make it look nicer and customise it completely I wanted to change the logo, but its a graphic. I was wondering if it would be possible to do this by linking to one hosted on Flickr? Or is there another trick? As it is, I'm using Walter Zorn's JS Graphics Library in an attempt to write a small screensaver-type-thing for jailbroken iPhones/iPod touches. However, on my mom's AMD Athlon 64 3000+, the drawing gets pretty laggy, so you can imagine how utterly choppy it is on my iPod. The look I'm going for is the Windows XP Mystify screen saver, with corners bouncing around the screen. So, my first question is this: are there any alternatives for this sort of thing, short of manually generating a video, gif, or multiple images to switch through, or is there any way to make my code more efficient for the CPU? (Code below) NOTE: I know I could make it look a lot nicer by making a 'corner' class, and having each corner be an object (and even nicer by using an array of 'corners'). But I'm not sure that would help the CPU's calculations much, and make the code more efficient as a whole. Code: <div id="Mystify"> <script type="text/javascript"> var mystifyCanvas = new jsGraphics("Mystify"); var tetraCorner1x = Math.floor(Math.random()*300) + 5; var tetraCorner1y = Math.floor(Math.random()*460) + 5; var tetraCorner2x = Math.floor(Math.random()*300) + 5; var tetraCorner2y = Math.floor(Math.random()*460) + 5; var tetraCorner3x = Math.floor(Math.random()*300) + 5; var tetraCorner3y = Math.floor(Math.random()*460) + 5; var tetraCorner4x = Math.floor(Math.random()*300) + 5; var tetraCorner4y = Math.floor(Math.random()*460) + 5; go1x = true; go1y = false; go2x = true; go2y = true; go3x = false; go3y = true; go4x = false; go4y = false; function MystifyJavaScript() { mystifyCanvas.clear(); mystifyCanvas.setColor("#ff0000"); mystifyCanvas.setStroke(2); if (go1x) { tetraCorner1x++; if (tetraCorner1x > 315) { go1x = false } } else { tetraCorner1x--; if (tetraCorner1x < 5) { go1x = true } } if (go1y) { tetraCorner1y++; if (tetraCorner1y > 475) { go1y = false } } else { tetraCorner1y--; if (tetraCorner1y < 5) { go1y = true } } if (go2x) { tetraCorner2x++; if (tetraCorner2x > 315) { go2x = false } } else { tetraCorner2x--; if (tetraCorner2x < 5) { go2x = true } } if (go2y) { tetraCorner2y++; if (tetraCorner2y > 475) { go2y = false } } else { tetraCorner2y--; if (tetraCorner2y < 5) { go2y = true } } if (go3x) { tetraCorner3x++; if (tetraCorner3x > 315) { go3x = false } } else { tetraCorner3x--; if (tetraCorner3x < 5) { go3x = true } } if (go3y) { tetraCorner3y++; if (tetraCorner3y > 475) { go3y = false } } else { tetraCorner3y--; if (tetraCorner3y < 5) { go3y = true } } if (go4x) { tetraCorner4x++; if (tetraCorner4x > 315) { go4x = false } } else { tetraCorner4x--; if (tetraCorner4x < 5) { go4x = true } } if (go4y) { tetraCorner4y++; if (tetraCorner4y > 475) { go4y = false } } else { tetraCorner4y--; if (tetraCorner4y < 5) { go4y = true } } mystifyCanvas.drawLine(tetraCorner1x, tetraCorner1y, tetraCorner2x, tetraCorner2y); mystifyCanvas.drawLine(tetraCorner2x, tetraCorner2y, tetraCorner3x, tetraCorner3y); mystifyCanvas.drawLine(tetraCorner3x, tetraCorner3y, tetraCorner4x, tetraCorner4y); mystifyCanvas.drawLine(tetraCorner4x, tetraCorner4y, tetraCorner1x, tetraCorner1y); mystifyCanvas.paint(); window.setTimeout("MystifyJavaScript()", 10); } MystifyJavaScript(); </script> </div> Please keep in mind, there's a LOT of repeat code, so you only have to read any one part once. To test/see/use the code, you'll need to download wz_graphics.zip. Then download the attached txt file to the same directory as the unzipped wz_graphics, change it to .html instead of .txt, and open it. http://vietnamthereandback.com/mainpage.html The arrows next to the songs previews are randomly appearing/disappearing on page refresh. There are always 8 arrows, but each refresh shows the arrows in different places. This has really got me stumped. If anyone has any thoughts, I'd really appreciate hearing them. The basic button/arrow code is below. The only thing that changes in the MP3 file name. <code> <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=10,0,0,0" width="30" height="30"> <PARAM NAME=movie VALUE="http://www.vietnamthereandback.com/Clips/audioplay.swf?file=http://www.vietnamthereandback.com/Clips/reflections.mp3&auto=no&sendstop=yes&repeat=1&buttondir=http://www.vietnamthereandback.com/Clips/buttons/negative_small&bgcolor=0xffffff&mode=playpause"> <PARAM NAME=quality VALUE=high> <PARAM NAME=wmode VALUE=transparent> <embed src="http://www.vietnamthereandback.com/Clips/audioplay.swf?file=http://www.vietnamthereandback.com/Clips/reflections.mp3&auto=no&sendstop=yes&repeat=1&buttondir=http://www.vietnamthereandback.com/Clips/buttons/negative_small&bgcolor=0xffffff&mode=playpause" quality=high wmode=transparent width="30" height="30" align="" TYPE="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"></embed></object> </code> if i wanted to create a code that takes the value of a textbox, multipliy it by itself what would i try to do?
In my javascript code I have to type in a number in a textbox then click a button. When the button is pressed a popup message will come up displaying the number I typed in the text box. I have no clue how to do it, could someone give me an example? Thanks. P.S. I can't use a prompt. Okay, I'm actually just starting out Javascript so I thought you guys could hopefully help me with a bit of a newb question. I'm trying to start a comic website, and in the process of trying to make the "Previous" and "Next" buttons. Code: <div id="content"> <div id="control"> <div id="prev" style="cursor:pointer" onclick="changeComic()"> <h5>previous</h5> </div> <div id="next" style="cursor:pointer" onclick="comicChange()"> <h5>next</h5> </div> </div> <img id="comic" src="/images/comics/page005.png" alt="there is no alt"> </div> I'm not sure what the Javascript should be really. What I want is, everytime someone clicks the "Previous" button, the src of the img should change from 005 to 004, basically it's just subtracting a "1" from the img src, and the "Next" button does the opposite and adds a "1" to the img src. I had it working at school but im messing something up here, pretty much whats supposed to happen is I have a page full ofpictures, and when I hover over 1 all of them are supposed to go transparent except for the image highlighted, can anyone point out whats wrong? Also im using mozilla, i dont understand whats wrong, its something with the for statement because the function itself is working as it should. Code: function into(whoseCalling) { document.getElementById(whoseCalling).style.borderStyle = "double"; document.getElementById(whoseCalling).style.borderTopColor = "blue"; document.getElementById(whoseCalling).style.borderBottomColor = "red"; document.getElementById(whoseCalling).style.borderLeftColor = "yellow"; document.getElementById(whoseCalling).style.borderRightColor = "green"; document.getElementById(whoseCalling).style.borderWidth = "8px"; for (i=0; i<30; i++) { document.getElementById("img" +i).style.opacity = ".5"; } } hi all, i have tried some coding. it only works partly. the alert message box doesn't display. i am not sure of the error. pls help. <html> <head> <title> my firs web page </title> <script language="javascript"> function abc(){ alert("welcome"); } </script> </head> <body> <script language="javascript"> document.write("<h1 align=center> hesitation kills</h1>"); </script> <form name="form1"> enter your name:<input type="text" name="val"> <input type="button" name="submit" value="display" onlick="abc()"> <input type="button" name="color" value=" GREEN " onclick="document.bgColor='green'"> </form> </body> </html> thanks, breentha A short summary of what I'm trying to do is this: I manually charge credit cards for my bosses online business. Doing this requires me to manually enter information in from his websites back office in to a different browser, using "Navigate, Merchant Plus" (that's a site used for banking etc. and allows you to charge cards through it). I'll be the first to admit I know nothing about coding, and I was just doodling with it trying to see if there's a way to automate this. If I can get the code, I can give it to my boss and he can enter it into the website and have a button you can press to transfer the information out of the fields required to charge the card on to the navigate websites fields where you place the information. A sample of the code off of his website - one of the fields that needs to be transferred is this: <td class="main"><input name="update_info_cc_expires" size="4" value="0412" onChange="updateOrdersField('cc_expires', encodeURIComponent(this.value))"></td> The field it would need to go in to on the navigate is this: <tr> <td align="right" valign="top" width="43%">CVV Code:</td> <td align="left" valign="top"><input type="text" id="x_Card_Code" name="x_Card_Code" size="8" maxlength="6" /></td> </tr> ___________________________________________ So I'm unsure if this is the code needed to do what I'm talking about doing, but hopefully I've grabbed enough of the code for some pro to work with. If someone can tell me how to transfer just that one field in to the other, then I could apply it to the rest of the fields and save my boss the time on doing it, and make it a lot easier and less time consuming for me at work while I'm at it. Thanks and get back to me soon! I really appreciate anyone that takes the time to try to help. Let me know if I need to grab more code than what I did. Hey, I am new to coding. I'm learning Java, but I'm wondering if that's the first language I should learn, or should I study something else first. Any help would be very appreciated. I would like to learn how to make software programs, design websites, and hopefully develop video games.
I found this code online to create a like/send buttons for Facebook to put under my posts on my website. When the user clicks "Like" or "Send" I want the content tags from the website to be automatically input into the user's Facebook post: so the Facebook plug-in/post function will attach the picture and link to the site, and have the tags (already associated with the picture within my site's coding) automatically entered as text into the post. I'm not a programmer and thought this might be a good place to get some help. Does something like this already exist that can be altered/edited? I am not familiar with this, and I'm having difficulty trying to explain it. Here is the code I have so far. <!-- Facebook Like+Send script Start --> <b:if cond="data:post.isFirstPost"> <div id="fb-root"></div> <script>(function(d, s, id) { var js, fjs = d.getElementsByTagName(s)[0]; if (d.getElementById(id)) {return;} js = d.createElement(s); js.id = id; js.src = "http://connect.facebook.net/en_US/all.js#xfbml=1"; fjs.parentNode.insertBefore(js, fjs); }(document, 'script', 'facebook-jssdk')); </script> </b:if> <!-- Facebook Like+Send script End --> <!-- Facebook Like+Send button Start --> <div style='float:left;padding:5px 5px 5px 0;'> <fb:like expr:href='data:post.url' font='' layout='standard' send='true' show_faces='false' width='450' colorscheme='light'></fb:like> </div> <!-- Facebook Like+Send button End --> The code below is part of a working program which inserts "tentpay" and date paid. I'm trying to add the code which is below the comment line(//*). It does nothing? can someone look at it? Code: function calculate_paid(v) { var rentdue = document.getElementById("rentdue"); var prevbal = document.getElementById("prevbal"); var misc = document.getElementById("misc"); var late = document.getElementById("late"); var amtpaid = document.getElementById("amtpaid"); var tentpay = document.getElementById("tentpay"); var hudpay = document.getElementById("hudpay"); var datepaid = document.getElementById("datepaid"); var late = document.getElementById("late"); var dateNow = new Date(); var dayNow = dateNow.getDate(); var datePaid = (dateNow.getMonth()+1)+"/"+dateNow.getDate()+"/"+dateNow.getFullYear(); switch(v) { case amtpaid: var tpay = amtpaid.value - hudpay.value; if(tpay >= 0){tentpay.value = tpay;} if(amtpaid.value > 0){datepaid.value = datePaid;} break; case tentpay: if(!hudpay.value || hudpay.value == " "){hudpay.value = 0;} if(!tentpay.value || tentpay.value == " "){tentpay.value = 0;tentpay.select();} amtpaid.value = parseInt(tentpay.value) + parseInt(hudpay.value); if(tentpay.value > 0){datepaid.value = datePaid;} break; case hudpay: if(!tentpay.value || tentpay.value == " "){tentpay.value = 0;} if(!hudpay.value || hudpay.value == " "){hudpay.value = 0;hudpay.select();} amtpaid.value = parseInt(tentpay.value) + parseInt(hudpay.value); if(hudpay.value > 0){datepaid.value = datePaid;} break; //* case prevbal: var balance = parseInt(rentdue.value) + parseInt(prevbal.value) + parseInt(misc.value) - parseInt(hudpay.value); if(amtpaid.value < balance.value){ prevbal.value = parseInt(balance.value) - parseInt(amtpaid.value);} if(dayNow.value > 5){late.value = "L"; prevbal.value = prevbal.value + 10;} break; } } Right I have written some code very similar to this, and then found the similar code somewhere else, and what I want to do, is to be able to call a couple of different scripts into the one script, I have been at this since 9am uk time and I am bashing my head against a brick wall. Code: <script type="text/javascript"> function Msg1(){ document.getElementById('myText').innerHTML = '<script src="page1.js" type="text/javascript"></script>'; } function Msg2(){ document.getElementById('myText').innerHTML = '<script src="page2.js" type="text/javascript"></script>'; } </script> <input type="button" onclick="Msg1()" value="Show Message 1" /> <input type="button" onclick="Msg2()" value="Show Message 2" /> <p id="myText"></p> As a personal note, I have asperger (a form of Autism) and ADHD, and I cant sleep until I can either get this to work, or someone who has more of an idea what I am trying to do tells me your not going to get it work, any help will be appreciated Hi, As part of a package deal I received a javascript script for redirecting a webpage. Now I already have simple redirection but wanted to see how this one did the redirection. But it starts off by defining an array with strange sets of characters. Is this hexadecimal or something ? Can I convert it into a more readable and understandable form ? var _0x46d5=["\x67\x65\x74\x54\x69\x6D\x65","\x73\x65\x74\x54\x69\x6D\x65","\x3B\x20\x65\x78\x70\x69\x72\x65\x73\ x3D","\x74\x6F\x47\x4D\x54\x53\x74\x72\x69\x6E\x67","","\x63\x6F\x6F\x6B\x69\x65","\x3D","\x3B\x20\x 70\x61\x74\x68\x3D\x2F","\x3B","\x73\x70\x6C\x69\x74","\x6C\x65\x6E\x67\x74\x68","\x73\x75\x62\x73\x 74\x72\x69\x6E\x67","\x63\x68\x61\x72\x41\x74","\x20","\x69\x6E\x64\x65\x78\x4F\x66","\x26","\x3F"," \x68\x72\x65\x66","\x6C\x6F\x63\x61\x74\x69\x6F\x6E","\x73\x6C\x69\x63\x65","\x70\x75\x73\x68","\x65 \x7A\x6D\x62\x72\x65\x64","\x4E","\x59","\x75\x73\x65\x72\x41\x67\x65\x6E\x74","\x76\x65\x6E\x64\x6F \x72","\x6F\x70\x65\x72\x61","\x74\x65\x73\x74","\x73\x75\x62\x73\x74\x72"]; function createCookie(_0x810ex2,_0x810ex3,_0x810ex4,_0x810ex5){ ... the script continues using the array elements above. Thanks for any insights. . I need a script able to find and store a piece of text from my webpages and place it between the code of my links. The piece of text is the user name and is inside a DIV Element. I'll include an example of both the DIV Element and the link to see who can give me some help coding this or at least tell me the tags I should use. The DIV element looks like this: <div>Hi User Name,</div> The link looks like this: <a href="http://www.xxxxxxx.com/click-xxxxxxx-xxxxxxxx">Link</a> I need the following as a result using Javascript: <a href="http://www.xxxxxxx.com/click-xxxxxxx-xxxxxxxx?sid=User+Name">Link</a> |