JavaScript - Site Coding Issue
Does anyone know of a website builder where you can add both java and html in both the body and the header. I have some code I need to add but I couldn't add html to the header in go daddy's website - tonight. I tried plesk sitebuilder but couldn't add anything to the header.
Anyone have any suggestions. I don't have amazing build skills either. Cheers John Similar TutorialsI'l not good in Javascript and I can't find anything about what I want.. . On a sports website there is a table with our ranking and results. On this site the content is changed weekly, but it stays in the same tables.. . Is it possible to make a javascript to get those tables and put them on my own website so the content will change on my site when the content is changed on the sports site? Please help me, it would save me lot of time.. . THx 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"; } } 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; } } 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 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 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. 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. if i wanted to create a code that takes the value of a textbox, multipliy it by itself what would i try to do?
Hey, I'm try to create a web page which slides down sub catagories when menus are clicked on. However, when the divs slide down there seems to be an unwanted 'snap' in the movement. Does anyone know how to solve this? Also, when the menu headings are clicked on the second time (which should slide the menu back up), the menu title disapears?? Heres the coding I've used and the link to the site: http://www.pumphouseapps.co.uk/graph...ents_page.html <script type="text/javascript"> $(document).ready(function() { var SectionName; var SectionNameLengh; var sectionChildName; var childName; $(".Subsection01").toggle( function () { SectionName=this.id; $("#"+SectionName).children().each( function() { var child = $(this); if (!(child.hasClass('MainSectionTitle'))) { child.slideDown(); } } ); /*$(".Subsection02").slideDown();*/ /*SectionNameLengh=this.id.length; sectionChildName= SectionName.slice(0,SectionNameLengh-4); $("#"+sectionChildName).show();*/ }, function () { SectionName=this.id; $("#"+SectionName).children().each( function() { var child = $(this); if (!(child.hasClass('MainSectionTitle'))) { child.slideUp(); } } ); /*$(".Subsection02").slideDown();*/ /* SectionName=this.id; SectionNameLengh=this.id.length; sectionChildName= SectionName.slice(0,SectionNameLengh-4); $("#"+sectionChildName).hide();*/ } ); $(".Subsection03").toggle( function () { SectionName=this.id; $("#"+SectionName).children().slideDown(); /* SectionName=this.id; SectionNameLengh=this.id.length; sectionChildName= SectionName.slice(0,SectionNameLengh-4); $("#"+sectionChildName).show();*/ }, function () { SectionName=this.id; $("#"+SectionName).slideUp(); /*SectionName=this.id; SectionNameLengh=this.id.length; sectionChildName= SectionName.slice(0,SectionNameLengh-4); $("#"+sectionChildName).hide();*/ } ); }); </script> Ok so i want to code something like this http://i45.tinypic.com/29y10s1.png I want it to where the user just clicks on one of the buttons and it changes to the thing. But then i want to be where if the user doesn't click anything then it just changes by itself. so like on a timer. Can anyone give me some references that might help me get started with coding this. I have no clue where tos tart. I am trying to build a simple test/questionnaire where the user inputs answers into a form. These answered are then checked with stored data in arrarys to see if they are correct or not. At the end the score is totaled and given to the user PROBLEM im confused at to how to structure the code and also am aware that i am missing several coding functions ect e.g. i know that i need to use 'getelementbyid' somewhere. ANY HELP WOULD BE APPRECIATED, THANK YOU CODE Code: <html> <script language="text/JavaScript"> function checkanswer() { if (q1==answer[0]) { alert('Right well done u got it correct') } else { alert ('unlucky you got it wrong') } answer = new Arrary(); answer[0] = "blue"; answer[1] = "green"; answer[2] = "red"; </script> <body> <form action="qform"> question 1: <input type="text" id="q1" value="" /> <br /> question 2: <input type="text" id="q2" value="" /> <br /> question 3: <input type="text" id="q3" value="" /> <br /> <input type="submit" value="submit" /> </form> </body> </html> I took a codeacademy course that had me program a basic search tool. I thought to attempt to fix the obvious major faults in the search code as sort of a self-evaluation of progress. The faults we 1: Similar names(used as an example search query) of similar lengths are also picked up by the search engine. 2: Only one text box can be searched for the desired word. I thought to fix this, and came up with the following code. I can't figure out why it isn't working, can anyone help me understand? Also, would there be a way to add an if loop to the two long if statements so that this code would work with any length name, instead of having to be rewritten for each name of different length? -JS- /*jshint multistr:true */ text = "Within this block of text this program is designed to pick out only my name, Jacob, and avoid selecting the similar strings of jacob, Jason, and James, leaving only instances of my name, Jacob within both this block of text and the following contained in the text block within var searchText."; var searchText = "Within this block of text this program is designed to pick out only my name, Jacob, and avoid selecting the similar strings of jacob, Jason, and James, leaving only instances of my name, Jacob within both this block of text and the one preceding contained in the text block above. Jacob Jacob"; var myName = "Jacob"; var hits = []; var hits2 = []; var hL = (hits.length) var hL2 = (hits2.length) for(var i = 0; i < text.length; i++) {if(text[i] === myName[0]) {for(var j = i; j < (myName.length + i); j++) {if(text[j] === myName[j - i]){hits2.push(text[j]);} } } } for(var i = 0; i < searchText.length; i++) {if(searchText[i] === myName[0]) {for(var j = i; j < (myName.length + i); j++) {if(searchText[j] === myName[j - i]){hits.push(searchText[j]);} } } } if (for(var k = 0; k < hits.length; k++) {if((k mod myName.length) === 0 && hits[k] !== hits[k mod myName.length]){hits[k] = "0"} else if((k mod myName.length) === 1 && hits[k] !== hits[k mod myName.length]){hits[k] = "0"} else if((k mod myName.length) === 2 && hits[k] !== hits[k mod myName.length]){hits[k] = "0"} else if((k mod myName.length) === 3 && hits[k] !== hits[k mod myName.length]){hits[k] = "0"} else ((k mod myName.length) === 4 && hits[k] !== hits[k mod myName.length]){hits[k] = "0"} } for(var z = hits.length - 1; z >= 0; z--) { if(array[z] === 0) { array.splice(z, 1); } } if (for(var l = 0; l < hits2.length; l++) {if((l mod myName.length) === 0 && hits2[l] !== hits2[l mod myName.length]){hits2[l] = "0"} else if((l mod myName.length) === 1 && hits2[l] !== hits2[l mod myName.length]){hits2[l] = "0"} else if((l mod myName.length) === 2 && hits2[l] !== hits2[l mod myName.length]){hits2[l] = "0"} else if((l mod myName.length) === 3 && hits2[l] !== hits2[l mod myName.length]){hits2[l] = "0"} else ((l mod myName.length) === 4 && hits2[l] !== hits2[l mod myName.length]){hits2[l] = "0"} } for(var y = hits.length - 1; y >= 0; y--) { if(array[y] === 0) { array.splice(y, 1); } } if (hits.length === 0) {Console.log("Your name wasn't found!");} else {console.log(hits); } if (hits2.length === 0) {Console.log("Your name wasn't found!");} else {console.log(hits); } Dear all, I am new here. Need a bit of help. In my company, we have a form that sends an email to a specific address, which is actually our internal helpdesk ticketing system. What we want to do is to make the address of the internal helpdesk ticket system show the person's email address, which is the Requestor_id as mentioned below. This webpage is running on Frontpage Server Extensions. However, when i insert the script in red and tested it on the server, it says that frontpage cannot send out this form due to some errors. Appreciate any form of assistance... Code: <form method="POST" action="--WEBBOT-SELF--" onsubmit="return FrontPage_Form1_Validator(this)" name="FrontPage_Form1" language="JavaScript"> <!--webbot bot="SaveResults" startspan S-Email-Format="HTML/BR" B-Email-Label-Fields="TRUE" B-Email-Subject-From-Field="FALSE" S-Email-Subject="ISP Local User Access" S-Builtin-Fields="" U-Confirmation-Url="../../SuccessMessage.htm" U-Validation-Error-Url="../../FailureMessage.htm" S-Email-Address="Reportticket.GlobalServiceDesk@pr1.xxx.com" S-Email-ReplyTo="<script type="text/javascript"> document.getElementById('Requestor_Email').value; </script>" --><input TYPE="hidden" NAME="VTI-GROUP" VALUE="0"><!--webbot bot="SaveResults" endspan i-checksum="43374" --> So, I have a situation in which I have a parent div.. <div id="parent"> </div> On page load that is empty but I have to make an ajax call to grab some XML and populate some structured elements. These elements, could be a few, need to then be appended into the "parent" div. Basically, read in the data, format it then innerHTML or bottom it to parent div. The thing is.. I have access to the prototype library and I can only think of the easy way of.. grab the nodes in the xml and use "new element" to create the display and slot in the xml data. THEN append it to parent and just loop thru the xml nodes and repopulate, append etc.. till done. But I am thinking this is old school. Is there a better, more robust, classier way of doing this. Is there a way to actually "pre=code" the display (and just style hide it) and "read in via jascript" the display and slot in the xml values and append it, then "show" it. like clone it, display it - etc... Something is telling me I can create a display object and slot the xml into it, append it and then keep calling to this display object. but not sure how to begin.... Hello, This is my second post on the forum and I am a coding beginner and therefore relatively new to the forum so sorry for any naive ignorance in the questions I may ask. I was wondering if anyone could please pass their assisstance regarding a functioning question...? I am completely stuck and cannot get my head around it on which methods are necessary?! For this question I think I have to follow the specification pretty regimently, eg. the example result has to include the double quotes around 'prog found in pages 0,3,5,6,9'. v) function findIdxsC(s) - to return a string containing the indexes in the pages array where s was found in the content part, e.g. "prog found in pages 0,3,5,6,9" [Note that this function will not contain an alert] Example call: findIdxsC("prog") Example result: "prog found in pages 0,3,5,6,9" Cheers, George 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> |