...

View Full Version : Creating html tags with javascript



butters
07-17-2011, 01:42 PM
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?

Hamza7
07-17-2011, 02:48 PM
Here is the 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&#93;";}</script>



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum