• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 155
  • Last Modified:

Select Correct Text

I have a main page called index.html

I have over 200 links on it.
Each link is name

lnka1
lnka2
lnka3
lnka4

and so on

I want it so when you click on lnka1 it goes to another page which which recieve a post or something so it loads /lnka1.txt
and /lnka1.jpg

Again for lnka2 when that is clicked load text and a picture form
/lnka2.txt
/lnka2.jpg

Basically save making 200 pages just make one
0
burnttime
Asked:
burnttime
  • 2
  • 2
  • 2
  • +1
1 Solution
 
COBOLdinosaurCommented:
You need to do it server side.  Just generate the page code with a script.

Cd&
0
 
burnttimeAuthor Commented:
This is the part where you tell me what script i need to use and how to use it

Thanx
0
 
COBOLdinosaurCommented:
I haven' t got a clue.  You have not given any information.  What scripting alnguage you use depends on what you support on the server, and how you generate it depends on what the txt files look like.

And above all what we can do depends on your skill levels with the tools available.

Cd&
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
Ryan ChongCommented:
or that your popup page, at least you need to have some javascript, that reads the location.href, and then using document.write method to write HTML code into that popup page accordingly, like you can write like:

<a href="page.html?image=lnka1" target="_blank">lnka1</a>

then in your page.html, try add like:

<script language="JavaScript">

var url = window.location.href;

var tmpArr = url.split("?");
var myimage = "";

if (tmpArr.length == 2) {
      var tmpArr2 = tmpArr[1].split("=");
      if (tmpArr2.length == 2) {
            myimage = tmpArr2[1];
      }
}

if (myimage != "") {
      document.write("<img src=\"images/"+myimage+"\" width=\"71\" height=\"25\">");
}

</script>

but it's a bit tracky if you want to load different contain from file according to the parameter passed in.

And since then, the Server Side Scripting Language should be the best way to handle in this situation, as what Cobol already mentioned above.

regards
0
 
Ryan ChongCommented:
oops, the link should be as like:

<a href="page.html?image=lnka1.jpg" target="_blank">lnka1</a><br>
<a href="page.html?image=lnka2.jpg" target="_blank">lnka2</a><br>
...
<a href="page.html?image=lnkaN.jpg" target="_blank">lnkaN</a><br>
0
 
YZlatCommented:
what language are you using?
0
 
YZlatCommented:
Here is a javascript solution, although it would be a lot easier with asp

on page1 have something like this

<html>
<head>
<title></title>

<script language="javascript">
<!--
function passValue(myVal) {
alert(myVal)
         newForm=window.open('page2.html?val= + myVal + ');
      newForm.document.forms[0].field1.value = myVal;

         
          }

//-->
</script>
</head>
<body>



<form name="form1" method="post">
<a href="#"  target="_blank" name="linka1" onclick="passValue(this.name);">lnka1</a><br><br>
<a href="#" target="_blank" name="linka2" onclick="passValue(this.name);">lnka2</a><br><br>
<a href="#" target="_blank" name="linka3" onclick="passValue(this.name);">lnka3</a><br><br>

</form>
</body>
</html>


on page2 you'll have:

<html>
<head>
<title>untitled</title>

<script language="javascript">
<!--
function getImageName() {
      
document.forms[0].myimage.src=document.forms[0].field1.value + '.jpg';
       
      }

//-->
</script>
</head>
<body>
<form>

<input type="hidden" name="field1">
<img src="image1.jpg" name="myimage">
</form>
</body>
</html>
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

  • 2
  • 2
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now