Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Web Programming > JavaScript > Javascript
|
Javascript General Javascript discussions.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 17th, 2011, 01:31 AM
Authorized User
 
Join Date: Sep 2008
Posts: 54
Thanks: 8
Thanked 1 Time in 1 Post
Default Hyperlink is not opening the web page, giving error ‘browser can’t find the file:’

Hyperlink is not opening the web page, giving error ‘browser can’t find the file:’ below is the code:
<html>
<head>
<title> Javascript </title>
<script language ="Javascript"><!-linkTo="www.msn.com"->
</script>
</head>
<body>
<a href="&amp;(linkTo);" >Click Here</a>
</body>
</html>
I have the internet connection but browser can’t find the file error is showing on the browser, please do check the attachments.
URL of the page: file:///C:/Users/Arbab/Desktop/Desk.html
URL of the page after the hyperlink has been clicked: file:///C:/Users/Arbab/Desktop/&%28linkTo%29;
Thanks in advance.
__________________
How to do programming?
 
Old February 17th, 2011, 07:12 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 996
Thanks: 2
Thanked 11 Times in 11 Posts
Send a message via Yahoo to melvik
Default

Dear Arbab I guess u did a simple mistake by addressing ur file or source to C:/Users/Arbab/Desktop/Desk.html since u r going to view it from NET so C:\... is useless & sure u'll get that error

correct me if Im wrong
__________________
Always,
Hovik Melkomian.
 
Old February 17th, 2011, 07:26 AM
Authorized User
 
Join Date: Sep 2008
Posts: 54
Thanks: 8
Thanked 1 Time in 1 Post
Default I m going to view it from internet!!!

I m going to view it from the internet, then what should be the changings in the code? or how should I save the program, i mean when i 'click' www.msn.com page from internet should get opened.
__________________
How to do programming?
 
Old February 17th, 2011, 12:07 PM
joefawcett's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

JavaScript doesn't have a data binding facility so refering to
Code:
&amp;(linkTo);
isn't going to replace the linkTo part with the linkTo variable.
You can bind yourself, easier if you give the a element an id such as 'myLink':
Code:
var link = document.getElementById("myLink");
link.href = linkTo;
and call this code in the document's onload handler.
If you find yourself writing a lot of this sort of code you may want to start using jQuery templates or the knockout.js library.
__________________
Joe
http://joe.fawcett.name/
 
Old March 15th, 2011, 02:45 AM
Authorized User
 
Join Date: Sep 2008
Posts: 54
Thanks: 8
Thanked 1 Time in 1 Post
Default what &amp;(linkTo); represent in Javascript?

Through your guidance I was able to make following program & it worked fine for me:

<html>

<head>

<title> Javascript 'Hyperlink' of page 43 of Javascript by James Jaworski </title>

<script language ="javascript">

</script>

</head>

<body>

<a href="http://www.google.com">Click Hyperlink to open website</a>

<a href ="&amp;(linkTo);" ></a>

</body>

</html>

but one think I did not understand as it is not described in the book and I did not able to find it on internet that "what &amp;(linkTo); represent in Javascript", could u break this and tell me.

Thanks in advance.
__________________
How to do programming?





Similar Threads
Thread Thread Starter Forum Replies Last Post
can’t open the page because the server where this page is located isn’t responding m_alsobaai Forum and Wrox.com Feedback 3 July 15th, 2010 06:13 AM
Opening a text file using hyperlink in a gridview absu General .NET 1 March 6th, 2009 02:03 AM
Opening a file using hyperlink absu ASP.NET 1.0 and 1.1 Basics 4 October 8th, 2008 09:24 AM
step of opening a web page somnath.kartic VS.NET 2002/2003 0 March 30th, 2006 03:24 AM
Web Page Not Opening Correctly Ben Horne Javascript 5 March 4th, 2004 01:15 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.