View Full Version : Java script help please
I have been working on this script for a long time now and I'm getting frustrated.
When you enter a url and generate the linking code, clear the form, enter a second url and create the code, it remembers the first URL. arrr
I want it to either save the generated code then create a new one under the first one.
Try it. Put a URL in, create code, Clear form, enter a second URL (different from the old one), create code and see what it does.
I came up with the idea I would just add a text box to copy and paste the generated code to, clear form, enter another URL and create code but it remembers the first code even after clearing the form... arrrr
Can someone please help with this script. If you have a site, I'd be glad to link to your site...
Here is where it is located for now
http://www.geocities.com/the_jr_webmaster/generator.html
Thanks
Erik
cloud9
09-01-2001, 06:51 AM
Your code needs fixing, or re-writing, I'm going to do it now......
cloud9
09-01-2001, 07:44 AM
:D Here is your code re-written. I have done my best to understand what you want it to do, but I expect it will need tweaking to get the exact results :D
<HTML>
<HEAD>
<TITLE>link maker</TITLE>
</HEAD>
<BODY>
<SCRIPT LANGUAGE="Javascript">
\\ **************************************************************************************************** ******************
function imagecode() {
imageURL = document.forms('imageURLmaker').ImageURL.value
document.forms('imageURLmaker').ImageURL.value=""
currentoutputsource=document.forms('imageURLmaker').outputsource.value
string="<IMG SRC='"+imageURL+"'>"
if (currentoutputsource=="") {document.forms('imageURLmaker').outputsource.value=currentoutputsource+string}
else { string = "<BR>"+string; document.forms('imageURLmaker').outputsource.value=currentoutputsource+string}
}
function helpimagecode() {
alert("This code will generate HTML code to insert an image into the forums.\n\nTo use it, type an image's URL (e.g. http://www.yahoo.com/y.gif) into the top textbox. Click the 'generate code' button to generate the code. If you want to add another image to the output HTML code, type it into the top box and click 'generate code' again. More code will be put into the large textbox.\n\n If you want to start again, click the 'clear form' button.")}
function clearimagecodeform() {
document.forms('imageURLmaker').outputsource.value=""
document.forms('imageURLmaker').ImageURL.value=""}
\\ **************************************************************************************************** ******************
function linkcode() {
linkURL = document.forms('linkURLmaker').linkURL.value; document.forms('linkURLmaker').linkURL.value=""
linkDescription = document.forms('linkURLmaker').linkDescription.value; document.forms('linkURLmaker').linkDescription.value=""
currentoutputsource=document.forms('linkURLmaker').outputsource.value
string="<A HREF='"+linkURL+"'>"+linkDescription+"</A>"
if (currentoutputsource=="") {document.forms('linkURLmaker').outputsource.value=currentoutputsource+string}
else { string = "<BR>"+string; document.forms('linkURLmaker').outputsource.value=currentoutputsource+string}
}
function clearlinkcodeform() {
document.forms('linkURLmaker').outputsource.value=""
document.forms('linkURLmaker').linkURL.value=""
document.forms('linkURLmaker').linkDescription.value=""}
function helplinkcode() {
alert("This code will generate HTML code to insert a link into the forums.\n\nTo use it, type the link and a description of it into the appropriate text boxes. Click on the generate code button to generate the HTML code. You may repeat the process to add more code to the large textbox or click the clear button to start again.")}
\\ **************************************************************************************************** ******************
</SCRIPT>
<FORM NAME="imageURLmaker">
<A HREF="javascript:helpimagecode()">Click here for help</A>
input a URL:<INPUT TYPE=textbox NAME="ImageURL" value="type an image URL here">
<TEXTAREA NAME=outputsource VALUE="" ROWS=5 COLS=80></TEXTAREA>
<BR><BR><INPUT TYPE=button value="Generate Code" onclick="imagecode()">
<INPUT TYPE=button value="Clear this form" onclick="clearimagecodeform()">
</FORM>
<HR>
<FORM NAME="linkURLmaker">
<A HREF="javascript:helplinkcode()">Click here for help</A>
input a URL:<INPUT TYPE=textbox NAME="linkURL" value="type link here">
input the description:<INPUT TYPE=textbox NAME="linkDescription" value="type the link's description here">
<TEXTAREA NAME=outputsource VALUE="" ROWS=5 COLS=80></TEXTAREA>
<BR><BR><INPUT TYPE=button value="Generate Code" onclick="linkcode()">
<INPUT TYPE=button value="Clear this form" onclick="clearlinkcodeform()">
</FORM>
</BODY>
</HTML>
:D now what shall I charge you..do you have a SPAM card ? :D
vBulletin® v3.6.7, Copyright ©2000-2009, Jelsoft Enterprises Ltd.