Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 07-17-2011, 01:42 PM   PM User | #1
butters
New to the CF scene

 
Join Date: Jul 2011
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
butters is an unknown quantity at this point
Creating html tags with javascript

Hi,

I wanna make a form that receives:

textbox URL And textbox Anchor

and result will be two anchors one <a href, and one phpBB

Example:

Url: www.pushpin.co.il
Anchor: pushpin

Results:
<a href="http://www.pushpin.co.il">pushpin</a>

[ url = http://www.pushpin.co.il/ ] pushpin[ /url ]

Help?
butters is offline   Reply With Quote
Old 07-17-2011, 02:48 PM   PM User | #2
Hamza7
New Coder

 
Join Date: Jun 2011
Location: Algeirs,Algeria
Posts: 43
Thanks: 5
Thanked 3 Times in 3 Posts
Hamza7 is an unknown quantity at this point
Here is the code:
Code:
<form>
  Url:<input type="text" id="url" /><br/>
  Anchor:<input type="text" id="anchor" /><br/>
  <input type="button" value="Generate codes" onclick="displayResult()"  />
  <input type="button" value="Reset" onclick="document.getElementById('result').innerHTML=''" />
  <div id="result"></div>
</form>
<script type="text/javascript">function displayResult(){
var url = document.getElementById("url");
var anchor = document.getElementById("anchor");
document.getElementById("result").innerHTML = "<a href='"+url.value+"'>"+anchor.value+"</a>" + "<br/>" + "[url="+url.value+"]"+anchor.value+"[/url]";}</script>

Last edited by Hamza7; 07-17-2011 at 02:52 PM.. Reason: phpBB code conflict.
Hamza7 is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 11:24 PM.


Advertisement
Log in to turn off these ads.