Webmaster Forum


Go Back   Webmaster Forum > Web Development > Web Design Lobby > Coding Forum
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Coding Forum Problems with your code? Let's hear about it.

Ezilon Directory   ClickBooth Network   V7N Directory

Reply
 
LinkBack Thread Tools Display Modes
Old 10-06-2006, 09:46 AM   #1 (permalink)
Junior Member
 
Join Date: 10-06-06
Posts: 19
iTrader: 0 / 0%
Latest Blog:
None

thenextbesthang is liked by many
I need help with some javascript:

I am trying to replace [[x y z]]
with
<a href="http://en.wikipedia.org/wiki/x_y_z">x y z</a>".
, similarly i am trying to replace [[x#y]]
with
<a href="http://en.wikipedia.org/wiki/x#y">x#y</a>
-----
here is what I have so far:
<html>
<head>
<title>Project.Link</title>
</head>
<body>
<script type= "text/javascript">
var input = window.prompt("Enter Text Here");
for(i=0;i<=input.length;i++)
{
var openbrackets = input.indexOf("[[");
var closebrackets = input.indexOf("]]");
var linkstart = openbrackets+2;
var linkend = closebrackets--;
var link = input.substring(linkstart, linkend);
}
for (i=linkstart;i<=linkend;i++)
{
if (link.charAt(i) == " ")
{
var replace_ = link.replace(" ", "_");
}
}
for (i=0;i<=input.length;i++)
{
var replaceo = input.replace("[[", '<a href="http://en.wikipedia.org/wiki/'+replace_+'">');
var replacec = input.replace("]]", '</a>');
}
var sentence = replaceo.concat(link);
var tsentence= document.write(sentence.concat(replacec));
</script>
</body>
</html>

------

Can anyone help me? Where is my code wrong?!?!
thenextbesthang is offline  
Add Post to del.icio.us
Reply With Quote
Sponsored Links
SEO Hosting by HostGator  Advertise Here  Buy Blog Links
Old 10-06-2006, 09:51 AM   #2 (permalink)
Freakgeek
 
Julie's Avatar
 
Join Date: 02-23-04
Location: Cleveland, Ohio
Posts: 17,397
iTrader: 0 / 0%
Latest Blog:
None

Julie is supreme webmaster materialJulie is supreme webmaster materialJulie is supreme webmaster materialJulie is supreme webmaster materialJulie is supreme webmaster materialJulie is supreme webmaster materialJulie is supreme webmaster materialJulie is supreme webmaster materialJulie is supreme webmaster materialJulie is supreme webmaster materialJulie is supreme webmaster material
Send a message via AIM to Julie Send a message via MSN to Julie Send a message via Yahoo to Julie
Move to coding forum please.
__________________

Julie is offline  
Add Post to del.icio.us
Reply With Quote
Go Back   Webmaster Forum > Web Development > Web Design Lobby > Coding Forum

Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
javascript help mtaylor314 Coding Forum 2 05-04-2007 03:46 PM
Count-up from a particular year + Javascript within Javascript? Help! Azam.biz Coding Forum 3 06-06-2005 06:47 AM
Javascript Help. samer Coding Forum 2 09-08-2004 07:50 AM
I need some help with JavaScript. Can anyone help me please? CrAg Coding Forum 2 03-22-2004 05:56 AM
javascript webmaster@lostinteardrops Coding Forum 16 10-31-2003 08:19 AM


Sponsor Links
Get exposure! Get exposure! Find Scripts Web Hosting Directory Get exposure! SEO Blog


All times are GMT -7. The time now is 12:38 AM.
© Copyright 2008 V7 Inc