DIV onClick in CSS
For the title of my website, I have the 开发者_开发技巧following code with a DIV onclick so that the user can click anywhere on the title and refresh the page:
<div class="title" onClick="document.location.href='xxxx';">
However the W3C validator tells me this:
there is no attribute "onClick"
I've read about doing this in jQuery, but I've not had much luck getting that work. Can anyone help me here?
Thanks
$(".title").click(function(){
document.location.href='xxxx';
}):
onclick
should be lowercase.
Some of the options.
<div class="title" onclick="javascript:reloadPage();">
function reloadPage()
{
window.location.reload();
}
or
<div class="title" onclick="window.location.href=window.location.href">
or
$(".title").click(function(){
document.location.reload();
}):
精彩评论