<
html
>
<
head
>
<
style
type
="text/css"
>
a:active
{
color
:
green
}
</
style
>
<
script
type
="text/javascript"
>
function
changeLink(){document.getElementById('myAnchor').innerHTML
=
"
Visit W3Schools
"
document.getElementById('myAnchor').href
=
"
http://www.w3schools.com
"
document.getElementById('myAnchor').target
=
"
_blank
"
}
function
getfocus(){document.getElementById('myAnchor').focus()}
function
losefocus(){document.getElementById('myAnchor').blur()}
function
access(){document.getElementById('myAnchor').accessKey
=
"
a
"
}
</
script
>
</
head
>
<
body
onload
="access()"
>
<
a
id
="myAnchor"
href
="http://www.microsoft.com"
>
Visit Microsoft
</
a
>
<
br
/><
br
/>
<
input
type
="button"
onclick
="changeLink()"
value
="Change link"
>
<
p
>
In this example we change the text and the URL of a hyperlink. We also change the target attribute.The target attribute is by default set to "_self", which means that the link will open in the same window.By setting the target attribute to "_blank", the link will open in a new window.
</
p
>
--------------------------------------------------------
<
br
/><
br
/>
<
input
type
="button"
onclick
="getfocus()"
value
="Get focus"
>
<
input
type
="button"
onclick
="losefocus()"
value
="Lose focus"
>
<
br
/>
--------------------------------------------------------
<
br
/><
br
/>
<
p
>
(Use Alt + a to give focus to the link.)
</
p
>
</
body
>
</
html
>
转载于:https://www.cnblogs.com/Elong/archive/2006/07/14/450971.html
相关资源:JAVA上百实例源码以及开源项目
转载请注明原文地址: https://mac.8miu.com/read-79477.html