JavaScript - Onclick Issue
Please explain! This is so frustrating :/
There is: <script language="text/javascript"> function spYL() { alert("FFFFFFFFFFFFFFF"); } inside head area and there is: <input name="Button" type="button" value="Επιλογή υλικών" onClick="spYL();"> But it doesn't work! Similar TutorialsHello, The code below assigns a value to the Latitude and to the Longitude table cells when the submit button is pressed. I would like to have these values appear in text boxes instead. Obviously I need to amend onclick="javascript:usePointFromPostcode(document.getElementById('postcode').value, placeMarkerAtPoint)" to make this work but I can't seem to. Assuming two text boxes with names lng and lat, how would I amend the line? Thanks Code: <p align="left"> <table bgcolor="#FFFFCC" width="300"> <tr> <td width="100"> <b>Latitude</b></td> <td id="lat"> </td> </tr> <tr> <td width="100"> <b>Longitude</b></td> <td id="lng"> </td> </tr> </table> </p> <p> Postcode: <input type="text" id="postcode" size="10" value="IG3 8PY" /><br /> <input type="submit" value="Find" onclick="javascript:usePointFromPostcode(document.getElementById('postcode').value, placeMarkerAtPoint)" /><br /> <div id="map" style="width: 500px; height: 500px"> </div> <p> <script src="http://maps.google.com/maps?file=api&v=2.x&key=ABQIAAAA43oi4HUU6ay_KI5aLlgqqxRs1CMn3rnBr6PSR_9LSokba_k_xRRX9T_bJ1PRZQ_1n4nF3EOK" type="text/javascript"></script> <br /> <script src="http://www.google.com/uds/api?file=uds.js&v=1.0&key=ABQIAAAA43oi4HUU6ay_KI5aLlgqqxRs1CMn3rnBr6PSR_9LSokba_k_xRRX9T_bJ1PRZQ_1n4nF3EOK" type="text/javascript"></script> <br /> <script src="gmap.js" type="text/javascript"></script> </p> </body> </html> Hello all, I'm trying to set up a web page to display a video when a user clicks on a link. So far, it works fine in IE and Chrome, but it won't work in Firefox. Any ideas? http://tinyurl.com/6u3jnq5 I'm currently working on a project and I am doing a bunch of image switching. I'm having a problem with the following... I have seven medium image objects and one small one. One is at the top and the other 7 are below. When one of the 7 is clicked, it then becomes the one up top and the one up top then takes the place of the image clicked. This needs to be able to happen no matter which of the seven i click. Also when you click one of the seven it runs a script to change 9 other images in the center of the page. this isnt too important because i have it working already. What i have is, each of the seven images run their function that changes the 9 center images and then it runs another function. What i need is for that function to determine which company for example(shaws, lowes, target) the top image belongs to and replace the image that was clicked with the top one. But i also need to replace the NAME="" and ONCLICK="function()" with the proper ones for the original company up top. Please if you can understand what im trying to do let me know, if you need further clarification i can do so. i can draw a picture of what im trying to do or the layout if needed but i cant necessarily show anyone the project due to a non-disclosure. Is it possible disable an onclick after clicking it and then enable it from another onclick by id Code: <img id="one" href="images/homepage/sliders/bonus_button.jpg" style="position:relative; top:30px; left:50px; height:30px; width:70px; float:left;"> This code runs when it is clicked: Code: $("#one").click(function() { runEffectB(); return false; }); What I would like to happen is for either runEffectB() to not run if it was just run or to disable the #one.click once it has run. I am assuming I will be able to re-enable it from another onclick running a similar function. This is jquery and jquery ui if that helps. Any ideas much appreciated. Hello... Here is an example of a site I'm working on: http://mrmatthewreese.com/surine/custominlays.php notice the links for the alien cross bones, celtic knot etc...change colors once they are clicked on? Is it possible to have the top (alien crossbone) be set to black before it is clicked on then changed to the grey color once a different link is clicked? Just curious if anyone can help. Here is the javascript code: <script language="JavaScript" type="text/javascript"> /*<![CDATA[*/ var Lst; function CngClass(obj){ if (Lst) Lst.className=''; obj.className='boldlink'; Lst=obj; } /*]]>*/ </script> <a href="#" onclick='changeimage();'><span onclick="CngClass(this);">Alien Crossbones</span></a><br /> <a href="#" onclick='changeimage2()'><span onclick="CngClass(this);">Celtic Knot</span></a><br /> <a href="#" onclick='changeimage3()'><span onclick="CngClass(this);">Compass Rose</span></a><br /> <a href="#" onclick='changeimage4()'><span onclick="CngClass(this);">Fleurdelis</span></a><br /> <a href="#" onclick='changeimage5()'><span onclick="CngClass(this);">Geometrix</span></a><br /> <a href="#" onclick='changeimage6()'><span onclick="CngClass(this);">Modern Vine</span></a><br /> <a href="#" onclick='changeimage7()'><span onclick="CngClass(this);">Nouveau</span></a><br /> <a href="#" onclick='changeimage8()'><span onclick="CngClass(this);">Scorpion</span></a><br /> <a href="#" onclick='changeimage9()'><span onclick="CngClass(this);">Traditional Block</span></a><br /> <a href="#" onclick='changeimage10()'><span onclick="CngClass(this);">TrebleBass Clef</span></a> Hi i have a page that allows the user to enter details and also upload an image , I have onclick event on a submit button that goes off and performs a geocode on the postcode and saves the lat long to a database along with the other details they enter ( which all works fine) . The problem is that when i use the onclick event with the submit button it seems to bypass the onclick JS function and just go straight to the image upload bit. Can a button be a submit button and also have an onclick event or is there anything else i can do to fix the problem? <a href="#" onClick="showClubs(<% Response.Write x_ID_Nanny %>);" > Now this showclubs function shows a hidden div and at the end I have a return:false; but when you click on the link - it still seems to reload to the page and take you to the top how can I get it to just show the div without seeming to reload the page? Hey. When a checkbox is checked, I want it to add the id number of what I've got in a PHP variable, to appear in a <input type="text" />. For example: The id is 1, 2, and 3. So 3 checkbox's. I click on the first, and it adds to another input field, '1'. I hit the second, and the same thing happens, except the id is 2. Of course, I know how to do the ID and all with PHP. All I need to do now, is where when you click a check box, it adds to another field, and adds & after every check. Here is my code: Code: <input type="checkbox" name="delete" onclick="this.checkedbox.style.display=(this.value=='checked' ? 'inline' : '2' )" /> <input type="text" name="checkedbox" /> Thanks. hi everybody.. i have this simple code: Quote: <html> <head> <script language="javascript" type="text/javascript"> document.write("<input type='button' value='push' onclick='hi()'/>"); function hi() { alert("hi"); document.write("<input type='button' value='enter' onclick='javascript: bye()'/>"); } function bye() { alert("bye"); } </script> </head> <body> </body> </html> if i try to run it on chrom its works well.. but on IE or FireFox its not define the bye() function.. whats the reason?! and how i can solve it?.. thanks very much.. Hey guys, OK, so I have two buttons (code below) that when a user clicks on it, it will place text in a textarea. You can view all the code below: Buttons: Code: <div id="newButton"> <a href="#"><img src="http://i49.servimg.com/u/f49/17/29/94/19/graphi10.png" alt="Request a Graphic"></a> <a href="#"><img src="http://i49.servimg.com/u/f49/17/29/94/19/review11.png" alt="Request a Review"</a> </div> The textarea ID is: Code: text_editor_textarea and this is the code that I would like to be placed inside the textarea: Code: Nature of Request: Creation Size: Primary Colors: Text To Insert: Donation: Extra Information: URL: I tried this, but the BBCode would not keep it's structure and would all end up on one line. EDIT: Oh...The BBCode is parsing inside the code box >.< Hello forum, My name is juan and recently started html programming. I have a web page with a drop box with the name of states. Code: <option value="">Alabama</option> <option value="">Alaska</option> I can add a onclick="code here" to the tag so that when the drop box alabama is selected it triggers the onclick event. Im using Ibox in order to have a image of the state open. Code: <a href="images/large/image_1b.jpg" rel="ibox" title="alabama at 1024x450!"><img src="images/small/image_1.jpg" alt=""/></a> the above is a <a> link tag correct? How do I go bout adding the above code into the onclick event? Hi, I use mostly PHP with my office's website as it usually requires some interaction with the server. However, i would like to do something that does not, and figured JS should be able to take care of it. I just can't get my head around it and would like to ask for some guidance...not the answer per say, just helping me get on the right path would be great! What i would like to do seems rather simple: I have a calendar. I would it to do one of two things: 1. Using onclick, when the user clicks on a date, i would like it to print something underneath the calendar. Similar to an error message that shows up on a login form if you type something wrong in a field using PHP (if(isset($whatever))). 2. Or using onMouseover, if the user hovers over a date that i have something special scheduled, i want a message to either pop up (alert()) or similar to #1, show up below the calendar. While fiddling with it this afternoon i figured i was close, but i am missing something... Code: <td><a href="#" onclick="document.getElementById("27").innerHTML='President's Day'; return false;">27</a></td> But this seems to be pulling information from an element whose id = 27...which is not what i'd like.. Thanks in advance, Tsiqueira Hi, I'm working on a small bit of code that passes a logged in users email address and name to a live chat form (Zompim & WHMCS) http://api.zopim.com/#setName By striping the code from the above page, I've managed to get it to work when the link is clicked, but I needed to have the variables passed upon page load. If anyone can point me in the right direction that would be great, me and Javascript don't work too well together! Here is what I have so far http://myautodj.com/zomp_test.php (your request a chat, and click on the run script link - that passes the demo email and name) Here is the code Code: <pre><script> $zopim.livechat.set({ language: 'en', name: 'Visitor', email: 'visitor@site.com', onStatus: function(s) { alert(s) } }); </script></pre> <script> (function() { var pres = document.getElementsByTagName('pre'), i; for (i=0; i<pres.length; i++) { buildLiveExample(pres[i]); } function buildLiveExample(p) { var code = p.innerHTML.replace(/>/g, '>').replace(/</g, '<'); var div = document.createElement('div'); if (code.search('<script>') == 0) { var a = document.createElement('a'); a.innerHTML = 'run script'; a.href = '#'; a.onclick = function() { eval(code.replace(/<\/?script>/g, '')); return false; }; div.appendChild(a); } else { div.innerHTML = code.replace(/<script>[\s\S]*?<\/script>/g, '') var code_blocks = code.match(/<script>[\s\S]*?<\/script>/g); if (code_blocks) { for (var i=0; i<code_blocks.length; i++) eval(code_blocks[i].replace(/<\/?script>/g, '')); } } p.parentNode.insertBefore(div, p); } })() </script> <script type="text/javascript"> document.write(unescape("%3Cscript src='" + document.location.protocol + "//zopim.com/?4vXfkefMFbxeWAVPjvRvWnBodfrGzctq' charset='utf-8' type='text/javascript'%3E%3C/script%3E")); </script> I am trying to use an onclick statement to go to an alternate web page displaying a different version of tha file being displayed in the current page. In the HEAD section of the current page I have a global variable named currentfile that contains a file name. This function is also in the HEAD section immediately below the variable's declaration Code: function altlink() { gotolink = "http://www.mydomain.com/testpage.htm?alt=" + currentfile; return gotolink } I have tried every combination I can think of in the onclick code to get it to work but, no joy. here is an example: Code: <a href="#" onClick=altlink(); return false; <img src="change.png" width="47" height="30"></a> If anyone here can sort me out I'd really appreciate it. I just can't get the next page to load. PHP Code: var deck = new Array (52); for (var ind = 0, face = 1; ind < 52; ind+=4, face++) { deck[ind] = face + "c"; deck[ind + 1] = face + "d"; deck[ind + 2] = face + "h"; deck[ind + 3] = face + "s"; } for (var a = 0, b = 0, c = 0; a < 19; a++, b+=2) { document.write("<img src='cards/placeholder.gif' name='" + deck[b] + "' width='53' height='68' onClick='alert(" + deck[b] + ")'>"); } I have this code for my Go Fish game, however it will not show an alert when you click the image. I've also tried onClick='alert(deck[" + b + "])' but that does not work either. Can someone help me please? At first : Peace of code i have now: Code: <a onclick="doRate('-1', '{$id}'); return false;"><img src="{THEME}/dleimages/down.gif" title="Blogai(-)" alt="Blogai(-)" class="r2-unit" width="16" height="16" align="absmiddle" /></a> So i thinking that if user has JavaScript in his browser disabled it won't work. So gonna change it to this : like i saw in other webs: Code: <a onclick="doRate('-1', '{$id}'); return false;" href="llink.html"><img src="{THEME}/dleimages/down.gif" title="Blogai(-)" alt="Blogai(-)" class="r2-unit" width="16" height="16" align="absmiddle" /></a> But i'm afraid that if user WILL have JS support enabled, href tag will be executed anyways. Any ideas? hey, im pretty much a newbie at scripting period, just a quick question. i know how to do a basic onclick function and how to add multiple functions, but is there a way i can make it so that way the onclick function only happens if the form its in returns true? (The onclick function is within the submit button of the form).
Hi Guys, I want to call the below when the page opens as opposed to clicking a link How do I alter it and do i need a function? THANKS <a href="#" onclick="new Lightbox.base('box3', { closeOnOverlayClick : true })">LINK Hello, I'm trying to make a small profile for my website, the website has a number of buttons on the left hand side allowing you to click the buttons and show the data or what they've clicked. For example when a player clicks on their statistics page, the statistics div will show up, and all the other div's will be hidden. If a player clicked on their friends list, the friends list div would be shown and all of the other div's would be hidden. I was able to show and hide the div's separately but I was unsure of how to make all the div's hidden apart from the one which they've clicked on. Thanks if you're able to help me. Link to user profile buttons - http://thepilotslife.com/usernew.php?user=Haydz I am currently working with a website that I would like the navigation buttons to change when clicked, but when another is clicked the previous is unclicked. If possible I would like to incorporate a rollover function that changes the image, and then when it is clicked the image stays. I am building a website with frames (not my idea) so when each of these buttons is clicked a frame is changed. I currently have everything setup with the frames and the graphics incorporated. I know how to do mousovers in css, but I'm not sure how to do it in javascript. I just have a simple table with images in rows so it really won't do me much good to show my code. Any help would be appreciated! |