I created this script:
<script>function txtload () {$(".divbody").load("maintxt/information1.txt");}</script>
I am using links like this:
<a href="#" onclick="ChangeImage(), txtload ()">Information 1</a>
I need to change the script to create multiple href’s loading different text for each link:
<a href="#" onclick="ChangeImage(), txtload ()">Information 1</a>
<a href="#" onclick="ChangeImage(), txtload ()">Information 2</a>
<a href="#" onclick="ChangeImage(), txtload ()">Information 3</a>
<a href="#" onclick="ChangeImage(), txtload ()">Information 4</a>
Can you help? I tried removing the “” from the script and placing it in the href itself…don’t have any idea what I’m doing…
Think this should work. Please give me your input:
<script>function txtload () {$(".divbody").load("maintxt/" + filename);}</script>
<a href="#" onclick="ChangeImage(), txtload ("information1.txt")">Information 1</a>
Thanks!
You could use a parameter
And then in your html:
Or if you really want it in your href use:
In your code is also a function
ChangeImagewhich you haven’t explained anywhere. I just ignored it in my example.Another way which is actually a little nicer is this script:
And then this html