Note that there are some explanatory texts on larger screens.

plurals
  1. POUsing a Javascript function to Return a value in a table element
    text
    copied!<p>I need to display this result as a background image of my table. I have added a function to the bottom of the javascript, but am unable to get it to pass thru. I removed the function it since it did not work.</p> <p>This works as it is now, but does not put the image in the background.</p> <p>Thanks.</p> <pre><code>&lt;HTML&gt; &lt;head&gt;&lt;base href="http://localhost:85/shop/" target="_blank"&gt;&lt;/head&gt; &lt;!--.&lt;style&gt; divcurve { border:1px solid; border-radius:5px; } &lt;/style&gt; --&gt; &lt;style&gt; IMG {BORDER-RIGHT: medium none; BORDER-TOP: medium none; BORDER-LEFT: medium none; BORDER-BOTTOM: medium none} &lt;/style&gt; &lt;script type="text/javascript"&gt; //Javascript Created by Computerhope http://www.computerhope.com //store the quotations in arrays var images = [], index = 0; images[0] = "&lt;a href = '/shop/category.aspx/about/711/'&gt;&lt;img src='/images/opc.png' alt='Tech Support' height='140' width='165'&gt;&lt;/a&gt;"; images[1] = "&lt;a href = '/shop/category.aspx/about/711/'&gt;&lt;img src='/images/opd.png' alt='Barcode Help' height='140' width='165'&gt;&lt;/a&gt;"; images[2] = "&lt;a href = '/shop/category.aspx/about/711/'&gt;&lt;img src='/images/opj.png' alt='Barcode Help' height='140' width='165'&gt;&lt;/a&gt;"; images[3] = "&lt;a href = '/shop/category.aspx/about/711/'&gt;&lt;img src='/images/opg.png' alt='Barcode Help' height='140' width='165'&gt;&lt;/a&gt;"; images[4] = "&lt;a href = '/shop/category.aspx/about/711/'&gt;&lt;img src='/images/opjb.png' alt='Barcode Help' height='140' width='165'&gt;&lt;/a&gt;"; index = Math.floor(Math.random() * images.length); document.write(images[index]); //done &lt;/script&gt; &lt;body&gt; &lt;table&gt; &lt;tr&gt;&lt;td width="20%&gt; &lt;img src="/images/phone.gif"&gt; &lt;/td&gt; &lt;td width="70%"&gt; &lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload