Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Get URL form user & display to page - Not Working.

Status
Not open for further replies.

MissouriTiger

Programmer
Oct 10, 2000
185
US
I'm attempting to display a link to HTML page. Name of site will appear, address will be in code. Both items come from user input. The name appears on page and pretends to be a hot link, but when you click it - Nothing! Here's my code. I would much appreciate if you would point out my mistake?

<SCRIPT LANGUAGE=&quot;VBScript&quot;>
<!--
OPTION EXPLICIT
document.bgcolor=&quot;DBDB70&quot;
document.write &quot;<BR><CENTER><FONT SIZE=7 FACE=arial COLOR=brown><B><STRONG>Problem 12</STRONG></B></FONT></CENTER><BR><BR><BR><BR>&quot;

Dim strURL
strURL=InputBox(&quot;Please enter the URL (Web address) of your favorite Website.&quot;)

Dim strName
strName=InputBox(&quot;What is the name of the Website?&quot;)

document.write &quot;<BR><CENTER><FONT SIZE=5 FACE=arial COLOR=red><B><STRONG><A HREF=strURL>&quot; & strName & &quot;</A></STRONG></B></FONT></CENTER>&quot;

//-->
</SCRIPT>

 
You probably need to change the last document.write statement to this...
Code:
document.write &quot;<BR><CENTER><FONT SIZE=5 FACE=arial COLOR=red><B><STRONG><A HREF='&quot; & strURL & &quot;'>&quot; & strName &  &quot;</A></STRONG></B></FONT></CENTER>&quot;

Notice the single quotes used to surround the url and the strURL outside of the document.write. Basically, the way it was would literally try to send you to strURL not
Later, Rob
robschultz@yahoo.com
-Focus on the solution to the problem, not the obstacles in the way.-
 
No, I'm trying your sugestion and it isn't working. It is now generating an error. It's worse than before. I don't get it.
 
I must be a total idiot. I typed it in and it didn't work. But when I paste in your code it works. So, thanks!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top