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
|