Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

JavaScript Forum


You are currently viewing our JavaScript Forum as a guest. Please register to participate.
Login



Reply
Opening a link in HTML/Javascript
Old 11-28-2010, 08:04 PM Opening a link in HTML/Javascript
Experienced Talker

Posts: 38
Name: jim
Trades: 0
Newbie here - I am using the following code to select and open a link. This code works but I have some questions. Please only reply if you can answer my questions - thanks! My questions are specifically about code that is *outside the <script> </script> area. Most of my questions are not covered by w3schools that I can find (or direct me to the correct page if they are).

Code:
<script>
<!-- define array of URLs -->

var daylinks=new Array();

daylinks[1]="file:///Users/myname/Documents/TEST/test_cs01.gif"
daylinks[2]="file:///Users/myname/Documents/TEST/test_ht01.gif"
daylinks[3]="file:///Users/myname/Documents/TEST/test_ms01.jpg"

var choice=3;

</script>

<!-- display link and display chosen URL in a new window -->

<a href="choice.htm" onClick="window.location=daylinks[choice];return false">View site.</a>

</body>
1) I have never seen this format described for an anchor <a> command. Where is the formatting and usage described?

2) There is no real URL associated with href="choice.htm". What does this element mean?

3) Is onClick a DOM Event? I see that JS events can be used in HTML tags. (See reference page at http://www.w3schools.com/jsref/event_onmouseup.asp)

4) Question for window.location: Can Javascript statements be used in HTML tags? Is there a reference page for statements?

Any help appreciated - Jim

Last edited by jwriter; 11-29-2010 at 01:09 AM.. Reason: clarification of information needed
jwriter is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 11-28-2010, 08:17 PM Re: Opening a link in HTML/Javascript
Super Spam Talker

Posts: 879
Name: Paul W
Trades: 0
Hi, sounds like you need a grounding in Javascript: http://www.w3schools.com/js/default.asp is an excellent introduction with loads of examples. Similar pages under w3 describe browser objects (the window.location you mention).
PaulW is online now
Reply With Quote
View Public Profile
 
Old 11-29-2010, 12:42 AM Re: Opening a link in HTML/Javascript
Experienced Talker

Posts: 38
Name: jim
Trades: 0
I edited my original question to be more specific about the information I need. -- Jim
jwriter is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Opening a link in HTML/Javascript
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.27137 seconds with 12 queries