How to

From Sohowiki
(Difference between revisions)
Jump to: navigation, search
(Question: How do I make a button that links to another website, but opens that link in a new window?)
(Question: How do I make a button that links to another website, but opens that link in a new window?)
Line 8: Line 8:
  
 
To make this button link to "www.example.com", insert the following "onclick" attribute...
 
To make this button link to "www.example.com", insert the following "onclick" attribute...
<pre>onclick="window.open('http://www.example.com','', 'width=800px, height=600px,resizable');"</pre>
+
<pre>onclick="window.open('http://www.example.com','',  
 +
'width=800px,height=600px,resizable');"</pre>
  
 
So the full code for the button should look something like...
 
So the full code for the button should look something like...
<pre><input type="button" onclick="window.open('http://www.example.com','', 'width=800px, height=600px,resizable');" style="width: 163px; color: rgb(29, 0, 237); height: 24px; background-color: rgb(249, 186, 0);" size="217" value="My Button"></pre>
+
<pre><input type="button" onclick="window.open('http://www.example.com',
 +
'', 'width=800px, height=600px,resizable');"
 +
style="width: 163px; color: rgb(29, 0, 237); height: 24px; background-color: rgb(249, 186, 0);" size="217" value="My Button"></pre>
  
 
Just replace "www.example.com" with the site you want to link to, and you're good to go.
 
Just replace "www.example.com" with the site you want to link to, and you're good to go.

Revision as of 18:40, 2 May 2006

Question: How do I make a button that links to another website, but opens that link in a new window?

Solution: Pull up the Text Editor where you put in the button, click on the "HTML" button at the bottom left.

The HTML for your button should look something like this...

<input type="button" style="width: 163px; color: rgb(29, 0, 237); height: 24px; background-color: rgb(249, 186, 0);"
size="217" value="Click here to go to example.com">

To make this button link to "www.example.com", insert the following "onclick" attribute...

onclick="window.open('http://www.example.com','', 
'width=800px,height=600px,resizable');"

So the full code for the button should look something like...

<input type="button" onclick="window.open('http://www.example.com',
'', 'width=800px, height=600px,resizable');"
style="width: 163px; color: rgb(29, 0, 237); height: 24px; background-color: rgb(249, 186, 0);" size="217" value="My Button">

Just replace "www.example.com" with the site you want to link to, and you're good to go.

Personal tools