Author Topic: Javascript for website  (Read 4202 times)

www.fullmm.com

  • Posts: 141
Javascript for website
« on: 11 Feb '09 - 12:59 »
Hello I want JavaScript source code for website which do this for me :

Get website link (itself !) and set specific image for page ; For example if link is http://www.sample.com/step1.aspx set an image in page with image1 and if link is http://www.sample.com/step1.aspx set image in page with image2

Thanks .

Zarggg

  • Posts: 1242
Re: Javascript for website
« Reply #1 on: 11 Feb '09 - 17:27 »
Your question would be best answered on a site specifically for web design.

r

  • Posts: 202
Re: Javascript for website
« Reply #2 on: 25 Feb '09 - 00:21 »
A little late in answering this, but you could probably use some type of URL parser for ASP.

Example:

<%
Thispage = Request.ServerVariables("URL")
%>

That should detect whether you're on "step1.aspx" or "step2.aspx".

Then you could do a simple if-else conditional to show the image based on the URL.

<%
If Thispage = "step1.aspx"
Then response.write('<img src="step1.jpg">')

Elseif thispage = "step2.aspx"
Then response.write('<img src="step2.jpg">')

Endif
%>

Not sure if the above code works... I'm more of a PHP guy!

But the logic is there!

[EDIT]
You mentioned javascript! Sorry about that!  Again the logic is there, you just need to apply it to javascript.