質問

I'm busy writing a webpage and I came into a couple problems using jQuery.

I needed to load the content into a div and that is going according to plan, but the problem now is that I want the index page to auto load the home.HTML into that div so I don't have to change to HTML files when I want to change content on the home page. but I don't know how to do that.

second problem I have with jQuery is the fact that using jQuery removes the active link hand cursor and replaces it with a test cursor if you hang over the link instead of creating an active link hand

does anybody know how to resolve these problems?

this is how I do the links:

<tr>
  <td><a onclick='$("#rightPan").load("content/zwangerschap.html");' title="Info">Zwangerschapsmassage</a></td>
  <td>60 Minuten</td>
  <td>€ 37,50</td>
</tr>

thanks for the help in advance!

役に立ちましたか?

解決

To auto-load your div, put your function in a document.ready wrapper:

<script>
    $(function() { // shorthand for `$(document).ready(function() {
        $("#rightPan").load("content/zwangerschap.html");
    });
</script>

You could skip that and just run the statement if you include the script after the HTML that it acts on, like right before the closing body tag:

    <script>
        $("#rightPan").load("content/zwangerschap.html");
    </script>
</body>

jQuery isn't changing your cursor. The fact that you don't have a (required) href attribute does that. http://jsfiddle.net/isherwood/jT8Uq

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top