faqts : Computers : Programming : Languages : JavaScript

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

2 of 3 people (67%) answered Yes
Recently 2 of 3 people (67%) answered Yes

Entry

How can I change the file extension on the same page , aa.com/122.jsp to aa.com/122.xml

Apr 7th, 2008 23:42
ha mo, Colin Fraser, Naren Nuggihalli,


You really have not given enough information to make an accurate 
determination. I could interpret it to mean you want to dynamically 
write a link according to predetermined condition or some other 
parameter. 
Try:
Wherever you are in the page: 
<script>
if (whatever you want to use here as a conditional) {
    document.write( "<a href="aa.com/122.jsp">Document</a> }
else
    {document.write( "<a href="aa.com/122.xml">Document</a> } 
</script>
That is simple. 
If you wanted to change the file extension on the user's computer, use 
Java.
http://www.businessian.com
http://www.computerstan.com
http://www.financestan.com
http://www.healthstan.com
http://www.internetstan.com
http://www.moneyenews.com
http://www.technologystan.com
http://www.zobab.com
http://www.healthinhealth.com