Hi
I need to create a HTML button that leads me on click to a website (i.e. google.de)
can anybody send me the code?
Thank you (I am a beginner)
Hi
I need to create a HTML button that leads me on click to a website (i.e. google.de)
can anybody send me the code?
Thank you (I am a beginner)
Last edited by djr33; 01-17-2012 at 02:44 AM.
Welcome juliememe to the forums
HTML Code:<input type="button" onclick="location.href('http://www.google.com');" value="Redirect">
or using a function
This should go in the <head> </head> section of your page.
This should go in the <body> </body>HTML Code:<script type="text/javascript"> <!-- function redirect() { window.location = "http://www.google.com/" } //--> </script>
Keyboard1333HTML Code:<input type="button" onclick="redirect()" value="Redirect">
Last edited by keyboard; 01-17-2012 at 09:25 AM.
Hi there juliememe,
and a warm welcome to these forums.
try it like this...
cootheadCode:<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <meta name="language" content="english"> <meta http-equiv="Content-Style-Type" content="text/css"> <title></title> <style type="text/css"> #mybutton { color:#000; text-decoration:none; } </style> </head> <body> <div> <a id="mybutton" href="http://www.google.com/" title="link to google.com"> <button>google</button> </a> </div> </body> </html>
Or:Code:<a href="http://google.com/"><button>Your First Button</button></a>
Code:<button onclick="window.location='http://google.com';">Your First button</button>
Daba! The Fantage-like website
Virtual World in progress.
Out of pure HTML, Javascript, and CSS. Oh, and poorly done Paint images.
This is your code:
HTML Code:<form method="LINK" action="http://yourlink.com"> <input type="submit" value="Button with link"> </form>
_________________________________________________________________
A free escort website solution for both independent escorts and agencies.
you can do it in various ways:
Using the below source will allow you to create a push button link. change the URL http://www.yoursite.com to the web page you wish to open.
other one is:Code:<FORM> <INPUT TYPE="BUTTON" VALUE="Home Page" ONCLICK="window.location.href='http://www.yoursite.com'"> </FORM>
remove spaces and carriage returns from code in quotes
A simple javascript can also fulfill your need:Code:<form> <input type="button" src="image-url" onClick="Javascript: window.open( URL, "_self", , True) > OR onClick="Javascript: window. location. replace( URL ) </form>
Complete code:Code:function Hi() { alert("psst"); } function addRowToTable() { var tbl = document.getElementById('secondtable'); var lastRow = tbl.rows.length; // if there's no header row in the table, then iteration = lastRow + 1 var iteration = lastRow; var row = tbl.insertRow(lastRow); var cell1 = row.insertCell(0); var buttonnode= document.createElement('input'); buttonnode.setAttribute('type','button'); buttonnode.setAttribute('name','sal'); buttonnode.setAttribute('value','sal'); cell1.appendChild(buttonnode); buttonnode.attachEvent('OnClick',Hi()); }
Hope this serves your purpose.Code:<html> <head><title></title> <script type="text/javascript" language="javascript"> <!-- Hide from browsers without javascript function g() { alert("you clicked?"); } window.onload=function() { var buttonnode= document.createElement('input'); buttonnode.setAttribute('type','button'); buttonnode.setAttribute('name','button'+3); buttonnode.setAttribute('value','sal'); buttonnode.setAttribute('onclick', function(){alert('Clicked')}); document.getElementsByTagName("body").item(0).appendChild(buttonnode); }; // End hiding --> </script> </head> <body> <div>some text</div> </body> </html>
Thanks
Last edited by djr33; 01-27-2012 at 09:54 PM.
Bookmarks