Closed Thread Icon

Topic awaiting preservation: Rollover Generator Pages that link to <a href="https://ozoneasylum.com/backlink?for=8856" title="Pages that link to Topic awaiting preservation: Rollover Generator" rel="nofollow" >Topic awaiting preservation: Rollover Generator\

 
Author Thread
The Jackal
Paranoid (IV) Inmate

From: The Dark Side of the Moon
Insane since: Jun 2000

posted posted 09-11-2003 21:14

Hi all. I am working on a JS rollover maker. The first part of the code allows the user to enter the number of rollovers they need (up to 25) and displays the input fields in a form, like so:

code:
<script language="JavaScript">
<!-- Hide me

var myNumber = parseFloat(prompt("Enter a number between 1 and 25",""));
var loopCounter;

if (!(myNumber <= 25) && myNumber > 1)
{
while (!(myNumber <= 25))
{
myNumber = parseFloat(prompt("This is an invalid entry. Enter a number between 1 and 25",""));
}
}
// end hide -->
</script>

</head>

<body bgcolor="#FFFFFF">

<script language="JavaScript">
<!-- Hide me

document.write('<form name="mouseOverForm" method="get">Image URL<P>');

for (loopCounter=0; loopCounter < myNumber; loopCounter++)
{
document.write('<input type="text" name="imgURL' + loopCounter + '" size="20"><P>');
}

document.write("</form>");

// Show me -->
</script>



The Second part of the code actually takes the information put in the input field and plugs it into a textarea, like so:

code:
<script language="JavaScript">
<!-- Hide me

function makeCode(form)
{
var imgURL = form.imgURL.value;
var headCode = "";
headCode += '<script language="Javascript">\r\n';
headCode += '<!-- hide me\r\n';
headCode += 'document.write("' + imgURL + '");\r\n';
headCode += '// show me -->\r\n';
headCode += '<' + '/script>';
form.theHead.value = headCode;
}
// end hide -->
</script>

</head>

<body bgcolor="#FFFFFF">

<script language="JavaScript">
<!-- Hide me

document.write('<form name="mouseOverForm" method="get">Image URL<P>');

document.write('<input type="text" name="imgURL" size="20"><P>');
document.write('<input type="button" value="Create Code" onClick="makeCode(this.form);"><P>');
document.write('<textarea rows="4" cols="30" name="theHead" wrap="virtual"></textarea><P>');

document.write("</form>");

// Show me -->
</script>



The problem is, that I can't get the two codes to work together. How do I get the function to add the info for an unspecified number of HTML input fields? Thanks for the help.

The Jackal
Paranoid (IV) Inmate

From: The Dark Side of the Moon
Insane since: Jun 2000

posted posted 09-15-2003 09:42

OK, perhaps I was not clear before, so I will try this again. Basically, I want to make a code like this one, only the user can enter the number of mouseovers they want at a prompt and that number of fields will write to the page.

« BackwardsOnwards »

Show Forum Drop Down Menu