JavaScript - Please Help Newbie
Hi what i'm trying to do is have it when once a user clicks on a banner the join raffle button will show after clicking on the banner, along with opening up a new window to the link the banner had. I've been trying to set up a onclick event to do this but haven't had success any help would be appreciated.
This is the code ive tried using. <div class="moduletable"> <a onclick="{AUP::RAFFLE=4}" href="http://godaddy.com" target="_blank" mce_href="http://godaddy.com"><img src="/images/stories/godaddy%20image.jpg" alt=""></a> </div> Here is the code for the raffle <tr> <td valign="top" colspan="2"> <form action="" method="post" name="RaffleForm"> <input type="hidden" name="aupraffleid" id="aupraffleid" value="4" /> <input type="hidden" name="aupraffleuserid" id="aupraffleuserid" value="63" /> <input type="hidden" name="auprafflepoints" id="auprafflepoints" value="1" /> <input type="hidden" name="auprafflepointsremove" id="auprafflepointsremove" value="1" /> <input class="button" type="submit" name="Submit" value="Sign up for this raffle now!" /> </form> </td> </tr> Similar TutorialsI have a js file to clean up a textarea when someone copies from a MS Word. I would like to be able to have this remove all the MS Word on submit rather than select a button in an editor. The cleanup.js in located in an includes folder and here is the submit form. How do I include the cleanup.js in this. Any help would be greatly appreciated! Code: <script language='javascript'> function saveChanges(saveDel) { //set the value based on save,delete, or edit document.editDelete.saveDel.value=saveDel; var retVal=true; document.editDelete.saveDel.onsubmit(); document.editDelete.saveDel.value=saveDel; if(saveDel=='delete') { //bring up a confirm if the user clicks delete retVal=confirm("Permanently delete the current record?"); } if(retVal) { //we can active the submit of the form document.editDelete.saveDel.onsubmit(); document.editDelete.submit(); } } </script> Hello I am new and need some help if possible please. I have a site of which i am putting together for a bit of fun and to teach myself but i need a little help from the masters of script if i may. I have a line of text but need it hidden but whatever i do i cant get it to work. It is on my contact page with HTML & a recaptcha & also a php file. What you see on my site is the following. name then empty field box email address then empty field box subject then field box prefilled with WEB SITE ENQUIRY comments then empty field box. What i would like is for the complete line in BOLD above to be hidden so it cant be seen on the website BUT i can see it when the email is received by me. I am having a bad day by not being able to complete this small task. Any help would be nice if somebody could edit the script for me. Many thanks </script> <div class="email"> <table> </tr> <tr> <td align="justify"> <p align="justify"><label for="name"><b>Name</b> *</label> </td> <td valign="top" align="justify"> <p align="justify"> <input type="text" name="name" maxlength="50" size="40"> </td> <tr> <td valign="top" align="justify"> <p align="justify"><label for="email"><b>Email Address</b> *</label> </td> <td valign="top" align="justify"> <p align="justify"> <input type="text" name="email" maxlength="100" size="40"> </td> <tr> <td valign="top" align="justify"> <p align="justify"><label for="subject"><b>Subject</b> *</label> </td> <td valign="top" align="justify"> <p align="justify"> <input type="text" name="subject" value="WEB SITE ENQUIRY" maxlength="50" size="40"> </td> </tr> <tr> <td valign="top" align="justify"> <p align="justify"><label for="comments"><b>Comments</b> *</label> </td> <td valign="top" align="justify"> <p align="justify"> <textarea name="comments" maxlength="2000" cols="40" rows="6"></textarea> </td> </tr> </table><input class="reset" type="reset" value="Reset All"> I am trying to create a personal webpage within Frames. The problem is, when I start the left frame, the main frame does what it's supposed to do, but if I click into the mainframe, it opens in an entirely new window, therefore losing my Frameset. I want to be able to visit webpages I have in an Array and be able to use the webpages (surf them, click on links and such). Please forgive the sloppy coding, I am a beginner. This is what I have so far: Frameset: Code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Untitled Document</title> </head> <frameset cols="220,*" border=5> <frame src="leftFrame.html" name="side" sideborder=1 Scrolling="no" marginwidth="5" marginheight="5" noresize> <frame src="mainFrame.html" name="main" sideborder=1 Scrolling="yes" marginwidth="5" marginheight="5" noresize> </frameset><noframes></noframes> </frameset> <body> </body> </html> Left Frame: Code: <html> <HEAD> <SCRIPT LANGUAGE="JavaScript"> <!-- Begin var page = new Array( "http://google.com" "http://ebay.com" "http://facebook.com" ); var endpage = "/the-end.html"; var slidenum = 0; var slidecount = page.length; var timerID = 0; var show_is_on = 0; var timedelay; var iteration; function showSlideShow() { slidenum++; if (slidenum < slidecount+1) { parent.main.location.href = page[slidenum-1]; document.getElementById('slnum').innerHTML = slidenum } if (slidenum == slidecount+1) { parent.main.location.href = endpage; } else timerID = setTimeout('showSlideShow()', timedelay); } function doShow() { if (!show_is_on) { show_is_on = 1; iteration = document.getElementById('startfrom').value if (iteration > 0) { slidenum = iteration-1 } setTimer(document.getElementById('interval').value); showSlideShow(); } } function stopShow() { clearTimeout(timerID); show_is_on = 0; } function setTimer(milliseconds) { timedelay = milliseconds; } // End --> </script> </HEAD> <P> <form name="form1"> Time delay: <input type="text" size="4" name="interval" id="interval" value="7000" /> <br>(In milliseconds) <P><input type="button" value="Start process" onClick="doShow()" /> <P><input type="button" value="Pause process" onClick="stopShow()" /> <P>Jump to:<input type="text" size="4" name="startfrom" id="startfrom" value="0" /> <P>Progress: <b id="slnum">0</b> of <b id="slcount">0</b> </form> <SCRIPT LANGUAGE="JavaScript"> document.getElementById('slcount').innerHTML = slidecount </SCRIPT> </HEAD> <BODY> </BODY> </html> Main Frame: Code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Untitled Document</title> </head> <body> </body> </html> Thanks in advance! I created a new website for documentation on the product we sell. It can be found at www.predatorgames.info. On the main page is this nice looking jquery photobox. When you click on the smaller pictures it will reload the main one. My problem is how do I make it so that when you click on the large image it will link to another site. Moreover, when they click on the small image it will load a new large image and I would want that to go to a different site if clicked. Dynamic. I was hoping someone could look at the source and tell me where I need to make the change. Please be specific as this is new to me. Thanks ahead of time for the help! Hi, I am brand new to any sort of programming and am taking an HTML class this quarter. We just started javascript and I am working on an assignment where we make a number guessing game. I have been working on this code for a few days and simply cannot figure out what is wrong. It simply doesn't work and at times locks up my browser (Mozilla Firefox). I don't want anyone to write the code for me, I just need a push to begin to understand what I'm doing wrong. Here is what I have so far: <code> <script type="text/javascript"> function guessingGame(){ var secretNumber=Math.floor(Math.random()*100)+1; var numberOfGuesses=0; var guessNumber=parse.Int(document.getElementById('guessNumberValue').value); document.getElementById("guessNumber").value=guessNumber; while (guessNumber!=secretNumber) { if (guessNumber<secretNumber) document.EricaGuess.response.value="Number too low"; if (guessNumber>secretNumber) document.EricaGuess.response.value="Number too high"; if (guessNumber==secretNumber) document.EricaGuess.response.value="You guessed the correct number!";} numberOfGuesses++; document.EricaGuess.numberOfGuessesValue.value=numberOfGuesses; } </script> </head> <body> <form name="EricaGuess"> <div id="Welcome"> <h2> Welcome to Ericas Guessing Game</h2> <p> Enter a number between 1 and 100. See how quickly you can figure out the magic number</p> <input type="button" value="Guess" onclick="guessingGame()"/> <input type="button" value="Reset" onclick="reset"/> <input type="text" id="guessNumber" name="guessNumberValue"/> <input type="text" id="response" name="response" size="75"/> <input type="text" id="numberOfGuessesValue" name="numberOfGuessesValue"/> </code> This is minus the opening and closing tags. Like I said, I am not asking for anyone to code this for me, just some help to understand what the problems are (I'm sure there are many). Thanks for any help you can give. Hi guys, i am trying to work with google maps api my issue is with creating an array of markers count the number of marker, and then if it equal two, issue an error msg. i wrote some code, but that doesn't work obviously. and my question is how do i write that code in javascript ? GEvent.addListener(map, 'click', function (overlay, latlng) { if (placeMarker.length < 2) { pendingLatLng = latlng; setTimeout("settleClick()", 225) } else { message("You can only select 2 points."); } }); a sample click event which looks like the line below does work. what am i doing wrong ?: google.maps.event.addListener(map, 'click', function (event) {placeMarker(event.latLng); }) Hi guys. Noob at Javascrip and html and this is semi-impossible to me currently. I am working on an assignment where I have 10 image files of 10 different countries. the instruction is to create a page that contains a table with 2 columns in a single row. In the first column, create a list of radio buttons that contains the names of the 10 countries. In the second column, display the flag of the country selected in an ?anchor? element. I am required to use the "onclick" event handler. I have been battling with this for hours, as this book I'm learning from makes assumptions as to the syntax I understand, without explaining it... Would someone please be as kind as to set me on the right path. I have included the sorry piece of code I came up with, that I gathered from other sites and tutorials. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Flags</title> <meta http-equiv="content-type" content="text/html; charset=iso-8859-1"/> </head> <body> <script type="text/javascript"> var cuba = "cuba.jpg"; var argentina="argentina.jpg"; </script> <form name="flagList" action="" method="get"> <p>Click on the country name to view its flag.</p> <p> <input type="radio" name="flag" onclick=document.flagList.flagJpg.value=cuba"/> Cuba<br/> <input type="radio" name="flag" onclick=document.flagList.flagJpg.value=argentina"/> Argentina<br/> </p> <p> <textarea name="flagJpg" cols="75" rows="20" style="background-color: blue; border: none; overflow :hidden; font: 10px tohoma; color:#3F3F3F:></textarea> </P> </form> </body> Hi everyone! 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 Hi, 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: <script language="javascript"> var season3pointer = "Ray Allen" if (season3pointer == Ray Allen) { alert("Good Answer"); } else { alert("You don't know anything about the Celtics") } document.write("<form action='http://www.nba.com/celtics/' method='post'>"+"<p>"+"Who has the record for most 3 points made in a game?"+ "<br/>"+"<input type='radio' name='game-3-pointer' value='bestrecord'>"+season3pointer+ "Antoine Walker"+"<br />"); </script> I know it should be very easy, but so far I have only found how to do it using functions, any help truly appreciated. Hi - can you please tell me the correct syntax for this please? Both scripts 'CalculateBasic' and 'CalculateTape' both happily return the correct amount - all I want to do is add them up to give me a form.price.value I just can't seem to get the right syntax. <script type="text/javascript"> function CalculateTot(form) { form.price.value = CalculateBasic(form) + CalculateTape(form); } </script> Please can you help Thanx Sorry to ask what surely must be a newbie type question, but any help would be gratefully appreciated. The following script does not display the first item listed in the option menu and I can't for the life of me figure out why not. Code: function goThere(ctrlName, ctrlFrame, ctrlTitle) { var oDDL = window.document.getElementById(ctrlName); //var oTitle = window.document.getElementById(ctrlTitle); //var sTitle = oDDL[oDDL.selectedIndex].innerText || oDDL[oDDL.selectedIndex].textContent; //oTitle.textContent = sTitle; //oTitle.innerText = sTitle; var sURL = oDDL[oDDL.selectedIndex].value; window.document.getElementById(ctrlFrame).src = sURL; window.document.getElementById('savePDF').href = sURL; ; } When the user first comes to the page, it should display "Kicker Sept10.pdf", instead it shows "Kicker Oct8.pdf" (except with firefox, then the initial display is black). Once the user clicks on the first item (Kicker Sept 10.pdf) the display is correct. Code: <select id="KickerSel" name="KickerSel" title="KickerEditions" onchange="goThere('KickerSel', 'KickerFrame', 'frameTitle')"> <option value="KickerEditions/Kicker Sept10.pdf">September 10th Edition</option> <option value="KickerEditions/Kicker Sept24.pdf">September 24th Edition</option> <option value="KickerEditions/Kicker Oct8.pdf">October 8th Edition</option> <option value="KickerEditions/Kicker Oct22.pdf">October 22 Edition</option> <option value="Kicker_Submit.htm">Guidelines For Submitting Articles</option> </select> <a id="savePDF" href="Kicker_page.htm" target="_blank" >Save</a> <!--<br /> <h1 id="frameTitle" >The Kicker</h1>--> <iframe id="KickerFrame" src="KickerEditions/Kicker 2011_10711.pdf" title="KickerEditions/Kicker 2011_10711.pdf" width="800" height="1034" frameborder="0" scrolling="no"></iframe></div> <br /> Please let me know if more explanation is needed. Thanks robkir I am very new to JavaScript and am trying to create a page that calculate net annual pay and pops up an alert box that states what they will take home as well as pay in taxes. I have figured my way out of created the boxes to enter fields and even got a calculate button. I cannot figure out the code the actually calculate the taxes! Field one is for first name and referenced by id: num1 Field two is for last name and referenced by id: num2 Field three is enter gross salary with id: num3 I am using 20% for federal taxes and 10% for state taxes and need it to show up in an alert box... Any ideas? Thanks! Hi guys, Started studying HTML , but having a bit of a problem creating <table>s. My instruction is to :"format the row in the table so that they alternate from white to grey. Within the grey rows format the text to white, Withing the white rows, format the text to black. I created a table for this in a previous exercise which I'll paste in the bottom. If I understand correctly, I need to use the table's <tr> element, but I don't know how it should be formatted. Any suggestions would be greatly appreciated. Here is what I got so far; <form action="" name="newsHeadlines"> <table border="0" width="100%"> <tr valign="top"> <td> <select name="headline" 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 aplication downloads approach 1 Billion </option> <option onclick="document.newsHeadlines.news.value=newsItem4"> Jones, Braves beat winless Nationals 8-5 </option> <option onclick="document.newsHeadlines.news.value=newsItem5"> America's uninsured haven't shown collective power </option> </select> </td> <td> <textarea name="news" cols="50" rows="10" style="background-color : Transparent"></textarea> </td> </tr> </table> <script type="text/javascript"> /* <![CDATA[ */ /8 ]]> */ var newsItem1 = "Example1"; var newsItem2 = "Example2"; var newsItem3 = "Example3"; var newsItem4 = "Example4"; var newsItem5 = "Example5"; </script> </form> Hi, there. I'm wanting to put a gif on my site that when clicked, will display a random page for the visitor to see next. The gif name is located on my site he image/nextrandombutton.gif I have the below saved at randomlink.js and have it loaded to my site. But I can't get it to work. <!-- /* Random link button- By JavaScript Kit (http://javascriptkit.com) Over 300+ free scripts! This credit MUST stay intact for use */ //specify random links below. You can have as many as you want var randomlinks=new Array() randomlinks[0]="http://www.bigpileofdogshirts.com/vintageorangecratedogs.htm" randomlinks[1]="http://www.bigpileofdogshirts.com/mikesibley.htm" randomlinks[2]="http://www.bigpileofdogshirts.com/floraldreams.htm" randomlinks[3]="http://www.bigpileofdogshirts.com/pirates.htm" randomlinks[4]="http://www.bigpileofdogshirts.com/ilovemycartoonpupsquares-new.htm" function randomlink(){ window.location=randomlinks[Math.floor(Math.random()*randomlinks.length)] } //--> I've tried all four of the below, but each returns a different error message. <a href="javascript:randomlink.js"><img src="images/nextrandombutton.gif"></a> <a href="javascript:randomlink.()"><img src="images/nextrandombutton.gif"></a> <a href="javascript:randomlink.js()"><img src="images/nextrandombutton.gif"></a> <a href="javascript:randomlink.()"><img border="0" src="images/nextrandombutton.gif"></a> I'm new to wordpress, I've just made a website and I want to make small modification: I want to remove the buttons in red. I thought it was CSS. But I've discovered that JS can't be overwritten by CSS so here I am. In firebug, I can see this: element.style { display: block; } When I change it to "display: none" buttons do disappear but I don't know in which file to find this sentence. A JS file is attached as txt. Can anybody give me a hand? This is the site: http://franciscourrea.com/sitio/ buttons by panchoskywalker, on Flickr Hi! Im new to the world of javascript, so bare with me. It might be a stupid question but i got a input form, i know how to get the data in but i need to single out one of the numbers. the input looks like: xxxxxx-xxxx I've tried almost everything that i can think of... A nudge in the right direction would be appreciated. Hi everyone, I'm currently stuck with a transition problem in my javascript (actually it's not mine) but since it's a little tricky to explain I've uploaded the page to a friend website so you can take a look at it. http://www.tanzstelle.net/simon/coel...red/index.html So when you hover between the link "car1" and "car2" the fading animation is absolutely correct but as soon as you hover lets say between "car2" and "car3" you'll see how during the transition "car1" shows up for a second - which is imho very annoying. Does anyone know how to tell js not to use "car1" between other transitions? I'm absolutely open to any new ideas but please remember I'm really a javascript/css newbie. Thank you. simon Hi There - I am a bit new to javascript and I am having a tough time coming to a solution to this problem I am having! I will try to explain.. first I have a call to a javascript button in a form of a form button: Code: <input type="submit" value=" Click This Button" onClick="fireMyPopup()"> Now the code for firemypopup() Code: function fireMyPopup() { myPopupRelocate(); document.getElementById("mypopup").style.display = "block"; document.body.onscroll = myPopupRelocate; window.onscroll = myPopupRelocate; } Now for the other function referenced there Code: Code: function myPopupRelocate() { var scrolledX, scrolledY; if( self.pageYOffset ) { scrolledX = self.pageXOffset; scrolledY = self.pageYOffset; } else if( document.documentElement && document.documentElement.scrollTop ) { scrolledX = document.documentElement.scrollLeft; scrolledY = document.documentElement.scrollTop; } else if( document.body ) { scrolledX = document.body.scrollLeft; scrolledY = document.body.scrollTop; } var centerX, centerY; if( self.innerHeight ) { centerX = self.innerWidth; centerY = self.innerHeight; } else if( document.documentElement && document.documentElement.clientHeight ) { centerX = document.documentElement.clientWidth; centerY = document.documentElement.clientHeight; } else if( document.body ) { centerX = document.body.clientWidth; centerY = document.body.clientHeight; } var leftOffset = scrolledX + (centerX - 850) / 2; var topOffset = scrolledY + (centerY - 200) / 2; document.getElementById("mypopup").style.top = topOffset + "px"; document.getElementById("mypopup").style.left = leftOffset + "px"; } As you might have guessed I am using this javascript to show a hidden div and keep it centered and following the screen scroll. This is working fine! It's the next part I am lost on! Here is the code for the div... Code: <div id="mypopup" name="mypopup" style="position: absolute; width: 800px; height: 400px; display: none; background: #ddd; border: 10px solid #000;"> <form action=(this will call a PL SQL package eventually)> <input type="hidden" name="CRN" value="'11111'"> <input type="hidden" name="TERM" value="1111"> <input type="hidden" name="CONF" value="y"> <input type="hidden" name="email1" value="1@aol.com"> <input type="hidden" name="email2" value="2@aol.com"> <input type="hidden" name="email3" value="3@aol.com"> <input type="hidden" name="activeemail" value="3"> <input type=''submit'' value='' Yes I Am 100% Sure'' onClick=''document.getElementById("mypopup").style.display="none"''>'); </form> </div> Ok now I will get to the nitty gritty here - the first issue is I would like to call the popup function and pass it a variable to signify which email is "active" amongst the hidden email fields. So when I call the popup function I want to say something like: Code: <input type="submit" value=" Click This Button" onClick="fireMyPopup(3)"> In a perfect world this 3 is passed along to fireMypopup and then somehow I would like to somehow change the active email hidden field to 3 as well. So my question is how would I change the code I provided to help me to figure out which email is active in the div. I am open to page refreshes etc, just has to be seemless i suppose. What am I trying to do? To sum it up I am printing an html form with lets say 15 rows. Each row has a column with an "email" button - which is this submit button. This submit button opens the "popup" or shows the div. Depending on which button is clicked I need to determine which email to send the email to. The popup window will be a simple form with 2 text fields and a submit button (which will call a PLSQL script to send the email) - but I need to know which hidden field email is the one that represents the click made. So the email gets sent to the proper email address :-) I am not opposed to new ways to do this - but the one constant is that these hidden fields containing all emails will be there. So if theres 15 emails, there will be 15 hidden fields + 1 for the active indicator (unless theres a better way) Thanks in advance - I am super confused! :-) - Jeff This is what I am aiming for. I want to be able to click on a word that would then write text in a specified area. This is what I came up with but it writes it at the top of the page and only for a moment then disappears.... These are my clickable words Code: <a href="#textarea" onClick="MathHomework('W2')">Week 2</a> <a href="#textarea" onClick="MathHomework('W3')">Week 3</a> the anchor named 'textarea' is where I want the output to be written which is placed on my html page. This is my newbie script Code: <script type="text/javascript"> function MathHomework(week) { if (week == "W2") document.write("<p>Review Chapter Twelve</p>"); else if (week == "W3") document.write("<p>Final Chapter Review Test</p>"); } </script> <a name="textarea"> (text area for javascript output)</a> so is my onclick syntax wrong maybe? and yes I have read rule#5 and I am trying to understand my mistakes. Thank you in advance Greetings, Perhaps someone with the knowledge could assist me with this problem ... Basically, I need to put some code together to automatically redirect a page back to the referring page after a short delay ... and frankly I'm banging my head against a brick wall LOL OK ... got this in HTML to auto redirect to a specific web page after a defined delay : Code: <meta HTTP-EQUIV="REFRESH" content="10; url=http://www.****.co.uk/index.htm"> ... and I have this javascript for redirecting back to the referring page using a button : Code: <form method="POST"> input type="button" name="B1" value="Try it now" onclick="history.back();"> </form> So the question is how to combine the two so that I can get the page to return to the referring page after a delay automatically (that is, without having to press a button) ???? Any assistance would be really appreciated. Many thanks. O T T |