GulfImages
Technical User
I just learning Javascript from snippets of script here and there and am adapting a cart system I found to my website: I've seperated the areas I have questions on with red. I've tested this script and it works great as is, I just need to change some things dynamically. Thanks in advance for any help.
document.writeln (
'<table>',
'<td class="padit">',
'<img id="imgborder" src="1771.jpg" width="450" height="300" alt="Picture 1771">',
Above, I would like to feed 1771.jpg to the script from each HTML document. I can get around this one if
it's not possible, but I think it may be.
'</td>',
'<td>',
'<br />',
'<form action = "javascript: void 0;"',
' method = "post"',
' onsubmit = "SetDesc (\'Print\');',
' SetWt (3.5);',
' SetCode (\'EPrt\');',
' SetQtyD (2, 15, 5, 20, 10, 25);',
//I would like to get the above function seperated
//from this script so I can adjust these numbers,
//but need it to run at this time.
' SetImg (\'1771thm.jpg\');',
//I need to feed 1771thm.jpg to this function from
//each HTML page.
' SetFixed (0,\'\');',
' SetQT (1);',
' if (ReadForm (this))',
' CallView ();',
' ClearAll ();',
' return false;">',
'Select Print Size: ',
' <select>',
' <option value = "5 x 7 s/n-1771 @10.00">5 x 7 @10.00</option>',
' <option value = "8 x 10 s/n-1771 @15.00">8 x 10 @15.00</option>',
' <option value = "11 x 14 s/n-1771 @25.00">11 x 14 @25.00</option>',
' <option value = "13 x 19 s/n-1771 @40.00">13 x 19 @40.00</option>',
' <option value = "16 x 20 s/n-1771 @60.00">16 x 20 @60.00</option>',
' <option value = "20 x 24 s/n-1771 @80.00">20 x 24 @80.00</option>',
' </select>',
I need to get this entire select statement into a
seperate script so I can change/add to it once,
and all the html pages will be updated
Is all this enough to ask for?.
'<br />','<br />',
'Quantity: ',
' <input type = "text"',
' name = "qty"',
' value = "1"',
' size = "4" />',
'<br />','<br />',
' <input type = "radio"',
' checked = "checked"',
' value = "Without Event Logo"',
' name = "r1" /> Without Event Logo.',
'<br />','<br />',
' <input type = "radio"',
' value = "With Event Logo +2.50"',
' name = "r1" /> With Event Logo. (+2.50 extra)',
'<br />','<br />',
' <input type = "submit"',
' name = "submit"',
' value = "Add to Cart" />',
' ',
' <input type = "button" ',
' value = "View Cart"',
' onclick = "CallView ();',
' return false;" />',
' ',
' <input type = "button" ',
' value = "Reset Form"',
' onclick = "ClearAll ();',
' this.form.reset();" />',
'<p class="twoul">',
'Quantity Discount (Duplicates of same picture)</p>',
'<p class="two">',
'2-4 = 15% off 5-9 = 20% off',
' ', ' ', '10+ = 25% off',
'</p>',
'</form>',
'</td>',
'</table>');
document.writeln (
'<table>',
'<td class="padit">',
'<img id="imgborder" src="1771.jpg" width="450" height="300" alt="Picture 1771">',
Above, I would like to feed 1771.jpg to the script from each HTML document. I can get around this one if
it's not possible, but I think it may be.
'</td>',
'<td>',
'<br />',
'<form action = "javascript: void 0;"',
' method = "post"',
' onsubmit = "SetDesc (\'Print\');',
' SetWt (3.5);',
' SetCode (\'EPrt\');',
' SetQtyD (2, 15, 5, 20, 10, 25);',
//I would like to get the above function seperated
//from this script so I can adjust these numbers,
//but need it to run at this time.
' SetImg (\'1771thm.jpg\');',
//I need to feed 1771thm.jpg to this function from
//each HTML page.
' SetFixed (0,\'\');',
' SetQT (1);',
' if (ReadForm (this))',
' CallView ();',
' ClearAll ();',
' return false;">',
'Select Print Size: ',
' <select>',
' <option value = "5 x 7 s/n-1771 @10.00">5 x 7 @10.00</option>',
' <option value = "8 x 10 s/n-1771 @15.00">8 x 10 @15.00</option>',
' <option value = "11 x 14 s/n-1771 @25.00">11 x 14 @25.00</option>',
' <option value = "13 x 19 s/n-1771 @40.00">13 x 19 @40.00</option>',
' <option value = "16 x 20 s/n-1771 @60.00">16 x 20 @60.00</option>',
' <option value = "20 x 24 s/n-1771 @80.00">20 x 24 @80.00</option>',
' </select>',
I need to get this entire select statement into a
seperate script so I can change/add to it once,
and all the html pages will be updated
Is all this enough to ask for?.
'<br />','<br />',
'Quantity: ',
' <input type = "text"',
' name = "qty"',
' value = "1"',
' size = "4" />',
'<br />','<br />',
' <input type = "radio"',
' checked = "checked"',
' value = "Without Event Logo"',
' name = "r1" /> Without Event Logo.',
'<br />','<br />',
' <input type = "radio"',
' value = "With Event Logo +2.50"',
' name = "r1" /> With Event Logo. (+2.50 extra)',
'<br />','<br />',
' <input type = "submit"',
' name = "submit"',
' value = "Add to Cart" />',
' ',
' <input type = "button" ',
' value = "View Cart"',
' onclick = "CallView ();',
' return false;" />',
' ',
' <input type = "button" ',
' value = "Reset Form"',
' onclick = "ClearAll ();',
' this.form.reset();" />',
'<p class="twoul">',
'Quantity Discount (Duplicates of same picture)</p>',
'<p class="two">',
'2-4 = 15% off 5-9 = 20% off',
' ', ' ', '10+ = 25% off',
'</p>',
'</form>',
'</td>',
'</table>');