[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference terri::web_authoring

Title:Welcome to WEB_AUTHORING
Notice:Before writing, please check for an existing topic
Moderator:VAXCAT::LAURIE
Created:Tue Mar 05 1996
Last Modified:Thu Jun 05 1997
Last Successful Update:Fri Jun 06 1997
Number of topics:186
Total number of notes:1479

169.0. "Creating a Button to "call" a URL?" by SCAMP::SMITH (Never say never, I always say.) Sat Mar 29 1997 18:20

I'm trying to create a Page at my Web Site, so when
I press a "button", it will go to a certain URL.

However, with the "code" I'm trying now, it semi-works,
in that it goes to the URL I want, except that it's
appending a "?" to the end of the URL.  It doesn't
seem to bother some Web Sites, but others don't like it.
Any suggestions on how to remove the aforementioned "?"
would be greatly appreciated.  Thanks!

Here's a piece of the code:

<HTML>

<BODY background="buttonpg.jpg">

<center><BR>

<H3><FONT Color="#66ffff">Click the </Font><FONT Color="#ffff00">button</Font><*
 <img src="blnkstar.gif" align=top>virtually<img src="blnkstar.gif" align=top> *

<Table Width=10% BGColor="#0000ff" Border=0 Cellspacing=6 Cellpadding=6>

<TR>

<TD>
<center>
<FORM NAME=TEST1 ACTION="http://home.netscape.com/" target="_parent">
<INPUT TYPE="SUBMIT" VALUE="Netscape">
</center>
</TD>
</FORM>

<TD>
<center>
<FORM NAME=TEST2 ACTION="http://www.microsoft.com/" target="_parent">
<INPUT TYPE="SUBMIT" VALUE="Microsoft">
</center>
</TD>
</FORM>

<TD>
<center>
<FORM NAME=TEST3 ACTION="http://www.winzip.com/" target="_parent">
<INPUT TYPE="SUBMIT" VALUE=" WinZip ">
</center>
</TD>
</FORM>

</TR>

</table>

</BODY>
</HTML>


(Mike)

T.RTitleUserPersonal
Name
DateLines
169.1I don't think there is any way around itHNDYMN::MCCARTHYA Quinn Martin ProductionMon Mar 31 1997 12:0112
Well that is a creative use of the ACTION clause in a FORM.  They are 
intended to fire off CGI scripts which then parse their input.

From memory the "?" in the URL is part of the information passed to the 
CGI script - in your example, you are passing no extra info so nothing 
trails the "?".  

I don't think you are going to be able to get the "?" removed without writting
a simple CGI script on your server that then requests the URL you are
trying to access.

bjm
169.2Can't use CGI - Any other ideas?SCAMP::SMITHNever say never, I always say.Mon Mar 31 1997 17:1313
BJM,

Oh, rats!  I'm using America Offline, and their Servers
don't currently support CGI Scripting, so I guess I'm
outta luck.  Do you know of any other way to do it at
all?  If there's a way to do it without using "Form"
stuff, that's fine with me.  I just want to press a
button and go to a URL.  Maybe JavaScript can do it?
Thanks.

Mike

169.3kissHYLNDR::BADGERCan DO!Mon Mar 31 1997 18:297
    Am I missing something here?
    
    why not:
    
    <a href="http://www.site.to.go.com"><img src=button.gif></a>
    
    ed
169.4Didn't wanna use GIF's for this page...SCAMP::SMITHNever say never, I always say.Mon Mar 31 1997 20:1217
re: -.1

Ed, I guess I wasn't too clear in the Base Note, but there
are going to be a lot of buttons on this page, and I really
didn't want to have to create gobs of GIFs for it.  I'd
rather use "pre-made" buttons that are available with code
such as this:

<FORM NAME=TEST1 ACTION="http://home.netscape.com/" target="_parent">
<INPUT TYPE="SUBMIT" VALUE="Netscape">

But with the above code, a "?" is being appended to the "action", so
a URL of http://home.netscape.com/? is what's being called.

Mike

169.5Method...AZUR::POULICHETBy what I know, that&#039;s what I thinkTue Apr 01 1997 10:057
Mike,

the "?" mark is used with the GET method (the default).
Try to add <FORM METHOD="POST" NAME=TES1...
                 ^^^^^^^^^^^^^

- Yvan.
169.6JGODCL::BOWENTwo stars short of a GalaxyTue Apr 01 1997 10:2117
    Or you could use a small hammer and use the following...

    <a href="javascript:Jump(&quot;Explore&quot;)">
    <img src="/~gif/Explore.gif" border="no" align=top alt=Explore></a>
    
    
    <SCRIPT LANGUAGE="javaScript">
    	<!--
    	function Jump(What) {
    	
    		if (What == "Explore")
    		{
     		   location = "/viewer/explore.asp";
    		}
    	}
    	//-->
    	</script>
169.7Yikes, the Security Alert!SCAMP::SMITHNever say never, I always say.Tue Apr 01 1997 16:0021
re: .5

Yvan, your idea worked, sort of...  Now, when the button
is pressed, the Security Alert (Passwords, Credit Cards,
etc.) appears.  I could live with that, I guess, but some
Sites don't like it.  Microsoft and WinZip worked okay,
but Netscape returned the following error after I clicked
OK on the Security Alert:

This server has encountered an internal error which prevents
it from fulfilling your request. The most likely cause is a
misconfiguration. Please ask the administrator to look for
messages in the server's error log.

I guess it thinks I'm trying to submit something to a non-
existent form, maybe?  Why do you suppose some Sites don't
care, but others do?  Different levels of security, perhaps?

Mike

169.8I'd try your plan, except I don't comprehend it!SCAMP::SMITHNever say never, I always say.Tue Apr 01 1997 16:0413
re: .6

I'd try your plan, except I don't comprehend it!  :^(

I'm not sure, but it appears I would need a separate
GIF File for each button, which I did want to avoid,
anyway.

Is that correct?

Mike

169.9one gif for all the "buttons"HNDYMN::MCCARTHYA Quinn Martin ProductionTue Apr 01 1997 19:519
>>I'm not sure, but it appears I would need a separate
>>GIF File for each button, which I did want to avoid,
>>anyway.


Point all the img= at the same .gif file - no problem.  The buttons you get 
from a form all look alike anyway.

bjm
169.10The JavaScript is a bit too tricky for me, yet...SCAMP::SMITHNever say never, I always say.Tue Apr 01 1997 21:5821
re: .6,.9

The JavaScript is outta my league for now.  I tried using
it, and it seemed to work as far as calling the URL cleanly
(I put the URL after Location = ), but I'm not clear on the
GIF part (among others).

Is the GIF file going to be the "button face", and
if so, how would it have a different label for each
button if it's the same GIF file over and over?

Would I need to define a different function for every
button/URL?  Etc., etc...

Guess I better invest in a book about JavaScript (but if
you're willing to help me a bit more, I won't complain)!
Thanks!

Mike

169.11JGODCL::BOWENTwo stars short of a GalaxyWed Apr 02 1997 10:018
    I use a different button for each, with Paint Shop Pro it's a matter of
    seconds to create one, you can however just use one with different
    text alongside it.
    
    There are various solutions with ActiveX controls but these only work
    with *intel* MSIE.
    
    Kevin
169.12Can I make the GIF's "press in" like buttons?SCAMP::SMITHNever say never, I always say.Wed Apr 02 1997 18:1412
re: .*

If I incorporate (well, attempt to incorporate would
probably be more accurate) some of the aforementioned
"GIF files for Buttons method", I'm just going to be
clicking on a picture to call a URL, but it won't
actually be "pressing in" like the Buttons I was
mucking with in the Base Note, right?

Mike

169.13Try a button with a click event?PENUTS::AERNIRon Aerni, AMCS IS @SHRThu Apr 03 1997 22:3318
How about using a button and assigning a URL to Window.Location.Href
when it is clicked?  Try the attached code on a page of your choosing.

			RJA


<form name="Form1">
    <input type="button" name="Button1" value="Microsoft"
	onClick="JumpSub('http://www.microsoft.com/')" language="VBScript">
    <input type="button" name="Button2" value="DIGITAL"
	onClick="JumpSub('http://www.digital.com/')" language="VBScript">
</form>

<script language="VBScript">
Sub JumpSub (URL)
    Window.Location.Href = URL
End Sub
</script>
169.14Error = JumpSub is not definedSCAMP::SMITHNever say never, I always say.Fri Apr 04 1997 23:488
re: -.1

Ron, I'm getting a JavaScript error
saying that JumpSub is not defined.

Mike

169.15try thisVMSBIZ::SANDEROpenVMS MarketingSat Apr 05 1997 00:4512
<html>
<head>
</head>
<body>
<form name="Form1">
    <input type="button" name="Button1" value="Microsoft"
        onClick="parent.location.assign('http://www.microsoft.com');">
    <input type="button" name="Button2" value="DIGITAL"
        onClick="parent.location.assign('http://www.digital.com');">
</form>
</body>
</html>
169.16JavaScript version of .13 (But .15 is shorter!)PENUTS::AERNIRon Aerni, AMCS IS @SHRSat Apr 05 1997 01:0525
Re: .14

Mike, I'm running IE 3.0x so I suspect the problem may be related to
IE supporting VBScript but your browser not supporting it.  You're
getting a JavaScript error and there is *no* JavaScript in it!  Below
is a JavaScript version of the form.  It works in IE but let's see if
this works for you!

			RJA


<form name="Form1">
    <input type="button" name="Button1" value="Microsoft"
	onClick="JumpSub('http://www.microsoft.com/')" language="JavaScript">
    <input type="button" name="Button2" value="DIGITAL"
	onClick="JumpSub('http://www.digital.com/')" language="JavaScript">
</form>

<script language="JavaScript">
<!--
function JumpSub (URL) {
    Window.Location.Href = URL;
}
-->
</script>
169.17.15 works with Netscape 3.XSCAMP::SMITHNever say never, I always say.Mon Apr 07 1997 21:498
re: .*

Well, .15 worked for me.  I'm running Netscape 3.X.
I will try .16 soon and post the results.  Thanks!

Mike

169.18Guess Netscape only likes JavaScript...?SCAMP::SMITHNever say never, I always say.Mon Apr 07 1997 22:157
When I tried .16 (with Netscape 3.X), I got:

Javascript Error:  Window is not defined

Mike

169.19Try this?YIELD::JBAKERMon Apr 14 1997 23:237
Don't know if you're past this, but at 
http://homepage.interaccess.com/~markarts/
this url has some cool buttons.  If you put
your mouse over them they push in, there is 
an onmouseover command in the frame source.

Jennifer
169.20Thanks, Jennifer! Good example!SCAMP::SMITHNever say never, I always say.Tue Apr 15 1997 21:309
re: -.1

Thanks, Jennifer.  Whoa, the "code" looks pretty serious (for
me, anyway)!  Guess I better get back to my "Dummies - You,
too, can learn JavaScript in 2 Years (maybe)" book.

Mike