HTML - Image Link Button
Hello i need help getting a button to work in my website. It will be a link to another page. I have this html. I have three images.They are gifs. I also have three more in .png. I can make just about any kind of file. When i made the files i used transparency and interlaced. I'll attach images. I want one to appear when to mouse goes over it and one to appear when it's clicked. The attached ones are .png's.
thanks Similar TutorialsHi im not sure if this can be done i have created some buttons to use as links and once i put the a href code in a box appears around the button can i remove this and how plz you can see example of what i mean on my website i have made Home and Contact clickable but i want to remove the box thats around the button if possible http://dreamteam0708.co.uk/ for info: im coding my own html in notepad, not using any programs or anything and my hosting doesnt support php etc I am creating a website that has a search button with an image. I would like to know if there is some simple code that I can include that would display the same basic image with a different color when the user mouses over the button. Here is the code: <FORM name="searchform" onSubmit="return validateSearch();" METHOD="POST" ACTION="search_results_lt.asp"> <INPUT TYPE="text" NAME="Search" VALUE="" SIZE="20" > <INPUT TYPE=IMAGE SRC="images/search_button.gif" Name="SearchButton" Value="Submit"> </FORM> **** Thanks for your help, Robin I want a link on the button. Means in my site I have a button Register and I want a link on the Button. How it could be possible. Thanks in advance Hello there, This is my first post and I'm no pro at web developement, so I would appreciate any help that you guys can offer! Basically I have made a pretty cool button in Flash, and it works fine -- I have inserted in into my Dreamweaver document fine, but I can't seem to figure out how to make this a link -- I want to make it that when people click the button, they are taken to another page of my site, so I just want to add a link to the SWF object I've inserted. Please could anyone shed some light on this for me please? How do I add a link? I know it can be done as you see Flash buttons that are links all over the internet (mainly ads!) -- so how do I do it (*using Dreamweaver)? Thanks in advance! Mike Hi guys, I have a drop down box via the <select> tag and then a submit button next to it. I want it so that if the drop-down shows "page 1" or something and then you hit "submit" it links to page 1. Same for "page 2" etc.. Is this possible, and how can I do it please! Thank you for any replies posted! Hey, i want to have a button which when pressed notifies me, it is to tell me if a link is broken. I dont want it to open a new page though. Thanks in advance. Hello, I posted this on another forum, but didn't get a conclusive response... Is it possible to make an HTML <button> act as a link without using Javascript's onClick handler, or indeed any Javascript at all? I was thinking something like: <a href="some link"><button>GO!</button></a> would work, but it doesn't seem to. Thanks, Can someone tell me why the "View Cart/Checkout" button on this page works in Mozilla but not IE7? http://www.usautomated.com/catalog/catalog.asp Thanks! So in January 2006 I posted a question about "making two buttons in one" 3 years and 5 months later i am happy to announce that I have found a solution. Ok, so no I have not spent the last three years looking, but the need for one came around again yesterday so I revisited the project. All I needed was "simple" image toggle. Image 'A' click it once it changes to image 'B' click it again it changes back to image 'A' All the "image toggle" codes I could find were extremely complex. I thought I had finally found one, it wasn't perfect, but it was the smallest and most basic thing I could find. HTML Code: <html> <head> <style type="text/css"> .on {background-image:url(playlist_btn.png); background-repeat:no-repeat;} .off {background-image:url(playlist_btn_x.png); background-repeat:no-repeat;} </style> <script language="javascript"> function togglestyle(el){if(el.className == "on") {el.className="off";} else {el.className="on";}} </script> </head> <body> <div id="onoff" class="playlist_btn"><img src="blank.gif" width="50 height="50" onclick="togglestyle(onoff)"></div> </body> </html> I tested it, it worked, so I considered problem solved. I placed it in my page and nothing. Turns out it wont work with a doc type - so it's useless. Other problems, I'm not big on using "blank gif's" unless I have to, if you want multiple image toggles you need a new JS function for each one, and two lines of css as well. And, though I rarely use image rollovers anymore, it would certainly not be possible in this method. So it was back to the drawing board. Well, I had actually already found the solution a few minuets prior to finding out that the above code is so good. I had coded a button that on rollover shows a tooltip, when you click the button, the text in the tool tip, changes, chick again and it reverts. All done with a simple showHide javascript function, that i am finfing out has many uses. here is the awesome code: Code: function showHide(elementid){ if (document.getElementById(elementid).style.display == 'none'){ document.getElementById(elementid).style.display = ''; } else { document.getElementById(elementid).style.display = 'none'; } } function hideShow(elementid){ if (document.getElementById(elementid).style.display == ''){ document.getElementById(elementid).style.display = 'none'; } else { document.getElementById(elementid).style.display = ''; } } I wont take credit for the showHide code, but I will take credit for the hideShow portion, obviously a monkey could have coded the revers, but iot does make it that much more universal. As the original code was designed to show something that was hidden, add the revers to hide something that is showing and it's perfect. Now I will take a moment to say, though I have yet to find a problem with the code, it seems to work in most browsers, firefox, ie, safari, and validates for WC3 - In sure it has it's flaws. Until now, to show and hide divs I had used the MM_showHideLayers JavaScript function, which by default used the visibility style. It is of course a good script, and has many uses, it's not very big, but it is somewhat complex. The other thing to think about is that invisible objects still take up space. That's what is cool about the display:none: style, is that is not only invisible but it doesn't take up space. So here is how I used the above to JavaScript to make a simple onclick image toggle: HTML Code: <img id="on" src="on.png" width="50" height="50" onClick="javascript:hideShow('on'); javascript:showHide('off')" alt="on"> <img id="off" src="off.png" width="50" height="50" onClick="javascript:hideShow('off'); javascript:showHide('plus')" style="display:none;" alt="off"> Cool huh? Now this example does not have a rollover either, but since it uses to individual images and is not replacing one image wioth another you could easily apply a rollover to both images. But, hold on, look at the above code, isn't that essentially a rollover? Change the first onClick to onMouseOver and the second to onMouseOut and look at that a 'brand new' method for mouseovers. So lets take a look at this for a second, and compare MM_swapImage to this new hideShow method. As far as CSS rollovers I definitely prefer them to the MM_swapImage method, as they use a minimal amount of code. However they actually take a lot of math, construction the buttons is somewhat tedious, because css buttons use 1 image and change it's position, to work well you have to use a "blank.gif" and the the css can really add up if you have a lot of buttons: Also, you can't go directly to a button in the document, you have to fish through the css to make any adjustments. But they are fast, they don't need to be preloaded and... they are pretty cool. But anyway, swapImage and hideShow... The left is the MM_swapImage method. Now when you use the swapImage js you also have to use MM_swapImgRestore, MM_findObj, MM_preloadImages. You don't have to use the preload script but it does make thing work faster... supposedly, but that requires a onload script in the body tag, and if you have a lot of rollovers your body tag can get really long really quick. So what are the advantages, well we know for sure it works, and you only need on image in the document, however actualy having the image you are "swapping" too actually in the document can add functionality. So as you can see, on the right, the showHide method is, in total code, much smaller. True you do need to use two images, so the total code in the body is longer but, it's more than evened out bu the minimal JavaScript, and I think it's worth it. You don't need to use a preloader, you have full control over both images, the up and over state, and unlike the swapImage method, though it's rare you would need to, your up and over images can actually be different sizes, which is kind of cool. So here's the basic code for a rollover: HTML Code: <img id="up" src="up.png" width="50" height="50" onMouseOver="javascript:hideShow('up'); javascript:showHide('over')" alt="up"> <a href="http://google.com"><img id="over" src="over.png" width="50" height="50" onMouseOut="javascript:hideShow('over'); javascript:showHide('up')" style="display:none;" alt="over" border="0"></a> To add a link the button you just apply it to the "over state" image. And unlike swapImage, though it is overkill, you can also add a "downstate" image quite easily. So, back to the on/off button here is how you would code it using showHide with rollovers. HTML Code: <img id="on" src="on.png" width="50" height="50" onMouseOver="javascript:hideShow('on'); javascript:showHide('onover')" alt="on"> <img id="onover" src="on_over.png" width="50" height="50" onMouseOut="javascript:hideShow('onover'); javascript:showHide('on')" onClick="javascript:hideShow('onover'); javascript:showHide('offover')" style="display:none;" alt="onover"> <img id="off" src="off.png" width="50" height="50" onMouseOver="javascript:hideShow('off'); javascript:showHide('offover')" style="display:none;" alt="off"> <img id="offover" src="off_over.png" width="50" height="50" style="display:none;" onMouseout="javascript:hideShow('offover'); javascript:showHide('off')" onClick="javascript:hideShow('onover'); javascript:showHide('off')"alt="offover"> So here is what is going on: you have the upstate on.png image, when you mouse over it on.png is hidden and on_over.png is displayed. When you click on_over.png it is hidden and off_over.png is display, mouse off it and off.png is displayed. Make scene? Now be aware, when you click, you are also in a scene "mousing off" so some flickering can occur. Firefox handles everything pretty well, IE and Safari not so much. When you click the on_over.png the click tells it to hide on_over.png and show the off_over.png, at the same time the mouseoff tells it to hide on_over.png and show the on.png. So fortunately the toggle with rollovers isn't perfect, but perhaps some more tweaking of the code or maybe, in this case swapImage would work better to do the rollovers... But all in all I'd say its a solid concept. If you feel compiled to do so, reply with any comments, concerns or flaws you see. Hi anyone who could help ! In the following code by clicking on the right bottom corner of the image, a link to the destination site occurs. <img src="images/4ticket.jpg" border="0" usemap="#Map" width="203" height="90"> <map name="Map"> <area href="www.destination/play.php" shape="rect" coords="72, 56, 185, 77"> </map Now I would like to replace the link with a form submit button, as I need the value of the submit button (Play FREE!) to be posted to the destination site. Thanks for any help or hint Hi all, I would like to ask for your help here. How can I first have a few radio buttons on my page and when the user select one of those, a text box with a submit button will appear. The text box is for the user to key in some kind of code/password so that it will prompt the user to a url according to the code/password. Example: Code: YAH URL: www.yahoo.com Code: GOO URL: www.google.com And if the user keys the wrong code it will prompt a message box asking them to try again. If the user key the code wrongly for 3 times it will prompt to another url. Ive also attach an example of how it should look like. I would appreciate for your help. Thanks a lot! Hi guys, As a person with VERY little HTML knowledge I getting very frustrated with a situation "I'm sure its a simple fix" that I hope you can help me with - there are 2 issues:- 1 - when you click on the Orange button on my website in IE the link doesnt work "it works when you right click - open link in a new tab" 2 - when you click on the Orange button on my website in Firefox - 2 tabs open instead of 1?? Any help would be very much appreciated - the link is http://www.twessential.com/newhome.html. If any files are need please let me know Many thanks I'm trying to have an input event also hyperlink to a page! Right now- this is what is happening: -Visitor hovers over an input-button image, this image changes -A second image on a different part of the page also changes when the visitor hovers what I want it to also do: -Visitor can click the button, and then go to a new page. Here is my code: HTML Code: <a href="http://google.com"><input id="A" type=image onmouseover="swap(this , srcA2 , srcXA)" onmouseout="swap(this , srcA , srcX)" value=" "></a> As you can see, I'm using both onmouseover & onmouseout tags. Right now, I'm also using a basic <a href=""></a> hyperlink in order to allow the visitor to click & go to a new page. This works in firefox just fine- but IE does not recognize the input button as a link. Are there any ways to solve this? I'm thinking I should use an OnClick event, but I don't know how to do this! Help would be greatly appreciated! I need an way to upload a file by clicking a link instead of button(<input type="file" name="somename"/>). This feature has been newly added to GMail, to attached a file we need to click a link. Any ideas or code of how this can be done are needed. Thanks hi guys! great day. i'm having problems getting the code for the submit button linked to my checkboxes. our professor wanted that every option or choice that we check on the check box, by clicking the submit button, the pop window should display "you have chosen (your choice/s that you have checked)" this is the code that my professor gave us. (just copy paste the code and open it) <!Doctype html public *-'W3C// DTD HTML 4.01 Transitional//EN"> <html> <head> <meta content ="text/html; charset = ISO-8859" http-equiv="content-type"> <meta keywords = "begin javascript"> <script type="text/javascript"> function outputVariableValues() { var yourName= document.myform.name.value; window.alert ("Hello: "+ yourName); window.alert ("Your Comment: "+ document.myform.comments.value); window.alert ("Thanks for rating us: " + document.myform.rating.value); } </script> <script type="text/javascript"> document.write("www.Ricmer.Mylene"); window.alert ("Welcome to heaven on earth") </script> <title>Web Form01</title> </head> <body> <center><h1>Nikki Nikko Webpage</h1></center> <form name="myform" method="" action=""> <p><label>Name:<input type ="text" value = "jasmine" name="name" size="25"></label> <p><label>Comments:<br><textarea name = "comments" rows = "4" cols ="36">Enter your comments here. </textarea></label></p> <p><label>Rate our Website</label> <select name = "rating"> <option selected ="selected">Amazing</option> <option>10</option> <option>9</option> <option>8</option> <option>7</option> <option>6</option> <option>5</option> <option>4</option>\ <option>3</option> <option>2</option> <option>1</option> <option>Awful</option> <input type = "button" name="submit" Value="Submit" onclick="outputVariableValues()"> <input type ="reset" value ="Reset" name="Reset"> </form> </body> </html> we're going to pass this activity tonight at 9pm. it's 4:12pm now..-_- this is our first time in html coding so i'm very sorry guys..and thanks in advance! I have a form and instead of clicking on a "Submit Button". I would like to have a text link that can be clicked to submit the action. Any ideas. Hi-- I have this button in a HTML/PHP contact form: <input type="submit" value="Submit" /> Preceded by this script in the Head: <script type="text/javascript"> $(function(){ $('#contact-form').submit(function(e){ e.preventDefault(); var form = $(this); var post_url = form.attr('action'); var post_data = form.serialize(); $('#loader', form).html('<img src="loader.gif" /> Please Wait...'); $.ajax({ type: 'POST', url: post_url, data: post_data, success: function(msg) { $(form).fadeOut(500, function(){ form.html(msg).fadeIn(); }); } }); }); }); </script> That combination works to submit the contact form using a php file called process.php. The problem is, I'd like to make that button into a LINK that does the exact same thing (my site doesn't want a button there). I have tried a javascript link, like so: function submitform() { document.forms["contact-form"].submit(); } </script> Followed by the js link: <a href="javascript: submitform()">Submit This</a> BUT this does not work to submit the form as the button does. Is there any way to do this? Many thanks for any help! I am ready to tear my hair out... the title makes it sounds really confusing. Ok im making my first website, and i need help with a code, (as you can see on www.dalekblaster.co.uk) i have got a section at the top where the images change from one to another. The code is - HTML Code: // Set slideShowSpeed (milliseconds) var slideShowSpeed = 5000; // Duration of crossfade (seconds) var crossFadeDuration = 5; // Specify the image files var Pic = new Array(); // to add more images, just continue // the pattern, adding to the array below Pic[0] = 'http://www.dalekblaster.co.uk/images/banner/dalekblasternexttime.jpg' Pic[1] = 'http://www.dalekblaster.co.uk/images/banner/dalekblaster2.jpg' Pic[2] = 'http://www.dalekblaster.co.uk/images/banner/dalekblastersjanexttime.jpg' Pic[3] = 'http://www.dalekblaster.co.uk/images/banner/dalekblaster.jpg' // do not edit anything below this line var t; var j = 0; var p = Pic.length; var preLoad = new Array(); for (i = 0; i < p; i++) { preLoad[i] = new Image(); preLoad[i].src = Pic[i]; } function runSlideShow() { if (document.all) { document.images.SlideShow.style.filter="blendTrans(duration=2)"; document.images.SlideShow.style.filter="blendTrans(duration=crossFadeDuration)"; document.images.SlideShow.filters.blendTrans.Apply(); } document.images.SlideShow.src = preLoad[j].src; if (document.all) { document.images.SlideShow.filters.blendTrans.Play(); } j = j + 1; if (j > (p - 1)) j = 0; t = setTimeout('runSlideShow()', slideShowSpeed); Now i need help because, i want to link each picture on the slideshow to a differnet page or external site, but im not sure how. (but so they can go to different pages not the same one) can anyone help me? Using below script after clicking the button it will reload the page and starting the application I want people go to anchor link location after clicking the submit button, for example go to the bottom of the page because the program is in the bottom of the page how to do that guys please help Code: echo '<form action="" id="frm_chat" method="post"><fieldset id="fieldset_chat"><legend>Chat</legend><div>'; echo $err_msg; echo "<label>Nick: </label>".$txt_nick->getHtml()."<br />"; echo "<label>Server: </label>".$ddl_server->getHtml()." or ".$txt_server->getHtml()."<br />"; echo "<label>Channel: </label>".$ddl_channel->getHtml()." or ".$txt_channel->getHtml()."<br />"; echo ' <input type="submit" class="btn" name="btn_chat" value="Chat Now"/></div></fieldset></form>'; I've tried multiple ideas but basically I just want it to be a regular grey button with the dimensions of the image I want to slap on the front of it so it will to a click down animation when someone clicks on it but so far all I get is this... HTML Code: <FORM METHOD="LINK" ACTION="mms://media.huntingtonnews.net/video/2007/BillDargusch-Downtowns-1.wmv"> <BUTTON TYPE="submit"><IMG SRC="http://www.huntingtonnews.net/images/baseball1-tn.jpg" alt="wow"></BUTTON> </FORM> And that is pretty good but the grey parts of the button sticking out make it look horrible. Does anyone know a way to shrink the button to the image size?... Codeguru |