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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Launching a Link

Status
Not open for further replies.

garman

Programmer
Jul 19, 2006
2
US
If I have a bunch of links such as:
<a href="something1.html">
<a href="something2.html">
<a href="something3.html">
<a href="something4.html">
<a href="something5.html">

Then, I prompt the user for a link, he/she enters the link. Can I then launch the link by some command in javascript.
What if the links were downloadable files such as *.doc?

Thank You.
 
I don't fully understand what you're asking there, but here's a quick example of how you can navigate to a new page that the user supplies (default being set to google):

Code:
<script type="text/javascript">

var a = prompt("Where do you want to go?", "[URL unfurl="true"]http://www.google.com");[/URL]
document.location = a;

</script>

-kaht

Looking for a puppy?

[small]Silky Terriers are small, relatively odorless dogs that shed no fur and make great indoor pets.[/small]
 
what do you mean prompt the user for a link? i suppose you could do:

Code:
var w = window.prompt("Enter your favorite website:", "[URL unfurl="true"]http://");[/URL]
window.open( w, 'myWindow', '');



*cLFlaVA
----------------------------
[tt]( <P> <B>)13 * (<P> <.</B>)[/tt]

[URL unfurl="true"]http://www.coryarthus.com/[/url]
 
Well what I mean is I have a webpage somePage.html. On this page there are several links. Let's say that the user presses a button that triggers a prompt box. The prompt asks the user: "Please enter a link that is located on this page that you would like to launch"
The user enters the link, clicks ok, and then the new webpage is launched.

Let's say that on the page I have 5 links to other pages
<a href="something1.html">
<a href="something2.html">
<a href="something3.html">
<a href="something4.html">
<a href="something5.html">

The user presses a button.
The user is prompted
The user enters a link
The link is launched

I want the user to enter something1.html and then I want the program to launch the page something1.html

I hope I have clarified my purpose.

Thank You for all you help
 
How is that different from what cory and I posted above? I guess the only difference is that you want the commands to be run once someone clicks a button.

If that's the part that you can't figure out then I suggest using google to search for "javascript onclick", and do some hefty reading, because that is pretty entry-level javascript stuff.

-kaht

Looking for a puppy?

[small]Silky Terriers are small, relatively odorless dogs that shed no fur and make great indoor pets.[/small]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top