javascript - link tag calling js function don't work -


i have static site classic menu like: home, services, contact etc links. what i'm trying reducing site's size. so, instead of using multiple pages links (like home.html, services.html) i'm trying keep 1 page , (when clicking occurs) dynamically change content.

html code (sample):

<a href="javascript:this.location.reload()" onclick="contactclick();">contact</a> <h1>old text</h1> 

js code:

function contactclick() {     $('h1').html('new text change, doesnt work, yay!');    } 

something funny happens. if click on link, 'old text' becomes indeed 'new text', 1 second! , then, changes right 'old text'!

i have tryied calling this: <a href="javascript:contactclick();"> , works fine, still need refresh page when click event occurs (i have color changing stuff on site, lol).

  1. is there way reduce site's size, or idea fine? or
  2. is there solve including refreshing site , calling js junction link?

perhaps shouldn't reloading page in href.


Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -