JavaScript - Javascript Float Table/image Bottom Right
I have been at this for days now.
THe problem is these scripts dont work well accross all browsers. I like how this script works but it opens a full window. And wont let me add table. http://www.dynamicdrive.com/dynamicindex4/logo_dev.htm But I can not get it to work with a table. The links I want to open a new window without scrolling, sizeable and toolbar. <table border="0" align="right" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF"> <tr> <td> <a href="unsaved:///Contact Us" onClick="MyWindow=window.open('https://domain.com/contactus.html"><img src="https://domain.com/images.gif" alt="Contact Us" border="0"></a> </td> </tr> <tr> <td> <center> <font face="Arial" size="3" color="#0000FF">call US</font> </a> </center> </td> </tr> <tr> <td> <center></a>or<a href="mailto:sales@domain.com"> Email Us</a> </center> </td> </tr> </table> Please help! Similar TutorialsMy issue is that I have a javascript function applied on page load via an addLoadEvent function call in the head to every row (dynamic number of records retrieved) on a table. On every row of the table I also have an element (image or button) that performs a different function that is assigned on the element itself. Unfortunately, when I click the element it also performs the function that was applied to the row in the page load. Is there any way to not call this function on element click? I know usually you include code, but due to the nature of the work I am limited in that respect. Basically its: Code: <script type="text/javascript"> addLoadEvent(function() { function1(1); }) //function1 makes the table rows do something appearance wise. </script> <tr> <td></td> <td></td> <td> <img src="pics/delete.png" alt="Delete" onclick="function2();"> </td> </tr> I apologize if my post doesn't conform to the general guidelines of proper posting on this board. I'm new on this site. Is it possible to use JavaScript to locate all of the "smiley sad Icon.jpg"'s and output the location within the table? Such as A3, and B2. Thank you in advance. Code: <html> <body> <table width="200" border="1"> <tr Id="A"> <td Id="1"><img src="http://www.hencam.co.uk/hencam_forum//extensions/Smile/tango/face-smile.png"> </td> <td Id="2"><img src="http://www.hencam.co.uk/hencam_forum//extensions/Smile/tango/face-smile.png"></td> <td Id="3"><img src="http://www.iconeasy.com/icon/thumbnails/System/Icons%20for%20Developers/smiley%20sad%20Icon.jpg"></td> </tr> <tr Id="B"> <td Id="1"><img src="http://www.hencam.co.uk/hencam_forum//extensions/Smile/tango/face-smile.png"></td> <td Id="2"><img src="http://www.iconeasy.com/icon/thumbnails/System/Icons%20for%20Developers/smiley%20sad%20Icon.jpg"></td> <td Id="3"><img src="http://www.hencam.co.uk/hencam_forum//extensions/Smile/tango/face-smile.png"></td> </tr> <tr Id="C"> <td Id="1"><img src="http://www.hencam.co.uk/hencam_forum//extensions/Smile/tango/face-smile.png"></td> <td Id="2"><img src="http://www.hencam.co.uk/hencam_forum//extensions/Smile/tango/face-smile.png"></td> <td Id="3"><img src="http://www.hencam.co.uk/hencam_forum//extensions/Smile/tango/face-smile.png"></td> </tr> </table> </body> </html> Hi all, I'd like to put all my js files at bottom, before the </body>, for Speeding Up my Site. I moved this type of code: Code: <script language="javascript" type="text/javascript" src="javascript.js"></script> from head to bottom, before the end tag of body. But it doesn't work. Why? Is it possible? Furthermore Validator W3C passed these pages. Thank you very much I have a scrolling div that has overflow set to hidden. I currently have it set up with a script that allows it to click and drag to scroll. However, I need some kind of visual indicator to show that you can scroll (sometimes it isn't obvious). I want to know if there's a way to have an image appear until you scroll to one end of the list or the other (the image can be inside the div, or outside). So in other words, there would be a down arrow at the bottom of the list any time you can scroll down (aka everywhere but the bottom) and an up arrow any time you can scroll up (aka everywhere but the top). Some type of fade out animation would also be nice, but not necessary if it over-complicates things. They would just be images, not functioning buttons. I would greatly appreciate any help. Thank you. trying to find a example of when you hover over a image, text appears on the bottom so it could be a picture of a dog, whne you put your mouse over it, text will show in the picture (ie* transparent background for text so it's readable) anywhre where I can find a example of this???? Hello, I am working on a page that has a jQuery full browser BG image and I am trying to also utilize a MooTools gallery. There seems to be some interference between the two JavaScripts as only one works (whichever one is last in order in the header of the HTML document). Links: http://www.courtneyhunt.com.au/press_bg.html http://www.courtneyhunt.com.au/press_gallery.html I am a complete novice with JavaScript so if anyone could help that would be great. Thank you in advance. Hello Everyone, So I am attempting to put a table within my JavaScript. However, everything that I try does not work. I have done a ton of research on how to do this but it's always with different scenarios, or it just does not work for me. Any hints would be appreciated, thanks! Code: <!DOCTYPE HTML PUBLIC "-//W3C//DTD xHTML 1.1//EN" "http://www.w3.org/TR/xhtml1/xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> <head> <meta http-equiv="Content-Script-Type" content="text/javascript"/> <link rel="stylesheet" type="text/css" href="UNIT_3.css"/> <title></title> </head> <body> <script type="text/javascript"> <!-- document.write('<h1>Number Square<h1> <br/>'); document.write('<table>'); for(var intSquare = 1; intSquare <=10; intSquare++) { document.write('<tr>'); document.write('<td>' + intSquare + "" + intSquare + '</td>'); document.writeln(intSquare + "" + intSquare * intSquare); document.write('</tr>'); document.writeln("<br/>"); } document.write('</table>'); // --> </script> </body> </html> Im making a html javascript table that is set to take the number of rows and cols from the user input. i cant make sense of the psuedocode the teacher gave us though. can anyone convert the psuedocode to actual code? the point of the lesson is while loops and do while loops. i basically understand the concept but his psuedocode confuses me :/ im trying to make my question is clear as possible. ask if i've left out a key detail var cols; var rows; cols = prompt("enter number of cols", "5"); cols = parseFloat(cols); rows = prompt("Enter ynumber of rows", "5"); rows = parseFloat(rows); print "<table border=1>" FOR i = 1 to rows DO print "<tr>" FOR j=1 to cols DO print "<td>Row " + i + " Col " + j + "</td>" END FOR print "</tr>" END FOR print "</table>" im confused about the "print" is that meant to be document.write.? ive tried a million ways. ps. the "cols" and "rows" are the variables. i already have it set to take the values with a prompt from the user. thanks alot (im a student trying to learn this in college) thats why the whole program is kinda pointless) I have an 11pm deadline to submit this. i'll go straight to the point, i have 8 rows and 3 columns, i want to populate each <td> starting from: row 0 column 0 a value of 1 row 0 column 1 a value of 2 row 0 column 2 a value of 3 row 1 column 0 a value of 4 row 1 column 1 a value of 5 ... row 7 column 2 a value of 24 let's say starting point is at row1 col1: | x | x | x | | x | 1 | 2 | | 3 | 4 | 5 | .......etc..... x = blank or no data here's the code: Code: <script type="text/javascript"> function changeContent() { var t = document.getElementById('tblVisaStk'); var k = getCookie('matrix'); // starting point, set in a different file var r = k[1]; // e.g. from R2C1, extract coordinates row 2 var c = k[3]; // column 1 var col; for(var i = r; i < r+8; i++) { for (var j = c; j < 3; j++) { if (t.rows.length > i) { if (t.rows[i].cells.length > j) { //t.rows[i].cells[j].innerHtml = (i-r)*3 + j + 1; t.rows[i].cells[j].appendChild(document.createTextNode(''+((i-r)*(3-c) + (j-c) + 1))); } } } } } </script> the starting point may vary, any help please? Hi I want to be able to use javascript to change an image i have sitting in a cell in a table The idea is to have a hyperlink that when clicked will change the image to something else. The cell is a fixed size so i would like to be able to resize the image to fit the fixed size. I may have some portrait images and some landscape ones so i need to detect which side is longest and resize accordingly so that the image fits in the cell with its porportions constrained. Does anyone know how i would go about this? Im very new to JS so im looking for some code somewhere to start it off. Thanks Hi, I am having a hard time to display a table with user preference of how many rows/columns to create a multiplication table. I think I have to user DOM but I am not sure and I am not sure how to use it. My question is, how do I get the user input to use as a dynamic array input in a for loop so I can create the multiplication table using CSS ? Here is my code: [CODE] Hi, I am having a hard time to display a table with user preference of how many rows/columns to create a multiplication table. I think I have to user DOM but I am not sure and I am not sure how to use it. My question is, how do I get the user input to use as a dynamic array input in a for loop so I can create the multiplication table using CSS ? Here is my code: Code: <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Strict//EN' 'http://www.w3c.org/TR/xhtml1/DTD/xhtml1-strict.dtd'> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <title> Multiplication table web page </title> <style type="text/css"> h2 {text-align: center;} table {position:absolute;left:300px;} </style> </head> <body> <h2>Multiplication Table</h2> <script type="text/javascript"> <!-- var size; do { size = prompt("What size table do you want?","10"); } while ((size < 1) || (size > 15)); document.write("<table border=\"5\" cellpadding=\"5\" cellspacing=\"5\">"); document.write("<tr><th> *</th>"); for(var i = 0; i < 10; i++) { for(var j = 0; j < 10; j++) { size = i * j; } } document.write("</table>"); // --> </script> </body> </html> Hey, I have modified a script that used to fade in a image (and it worked fine) to fade in a table with that image inside it. The table doesn't fade in The HTML that is produced is exactly this, but the hashes are urls: Code: <table style="float:left; opacity:0; "> <tr <td> <a href="#" rel="lightbox[group]"> <img src="#" width="97" height="97" /> </a> </td> </tr> <tr> <th> </th> </tr> </table> These are my two functions Code: function addImage(src) { var table = document.createElement("table"); table.style.float = "left"; var tr_1 = document.createElement("tr"); var td_1 = document.createElement("td"); var a_1 = document.createElement("a"); a_1.src = src; a_1.rel = "lightbox[group]"; var img_1 = document.createElement("img"); img_1.src = src; img_1.width = 97; img_1.height = 97; a_1.appendChild(img_1); td_1.appendChild(a_1); tr_1.appendChild(td_1); var tr_2 = document.createElement("tr"); var th_2 = document.createElement("th"); tr_2.appendChild(th_2); table.appendChild(tr_1); table.appendChild(tr_2); document.getElementById("thumbnails").appendChild(table); if (table.filters) { try { table.filters.item("DXImageTransform.Microsoft.Alpha").opacity = 0; } catch (e) { // If it is not set initially, the browser will throw an error. This will set it if it is not set yet. table.style.filter = 'progid:DXImageTransform.Microsoft.Alpha(opacity=' + 0 + ')'; } } else { table.style.opacity = 0; } table.onload = function () { fadeIn(table, 0); }; } function fadeIn(element, opacity) { var reduceOpacityBy = 5; var rate = 30; // 15 fps if (opacity < 100) { opacity += reduceOpacityBy; if (opacity > 100) { opacity = 100; } if (element.filters) { try { element.filters.item("DXImageTransform.Microsoft.Alpha").opacity = opacity; } catch (e) { // If it is not set initially, the browser will throw an error. This will set it if it is not set yet. element.style.filter = 'progid:DXImageTransform.Microsoft.Alpha(opacity=' + opacity + ')'; } } else { element.style.opacity = opacity / 100; } } if (opacity < 100) { setTimeout(function () { fadeIn(element, opacity); }, rate); } } this is the previous addImage function: Code: function addImage(src) { var newImg = document.createElement("img"); newImg.style.margin = "5px"; document.getElementById("thumbnails").appendChild(newImg); if (newImg.filters) { try { newImg.filters.item("DXImageTransform.Microsoft.Alpha").opacity = 0; } catch (e) { // If it is not set initially, the browser will throw an error. This will set it if it is not set yet. newImg.style.filter = 'progid:DXImageTransform.Microsoft.Alpha(opacity=' + 0 + ')'; } } else { newImg.style.opacity = 0; } newImg.onload = function () { fadeIn(newImg, 0); }; newImg.src = src; } The opacity of the table stays at 0, and never appears (but I can still click on the link) Can anyone help me make the table fade in like it was supposed to? Hi guys, I am new to this forum and I am sorry if this is not the right section to post this. Please move this to the appropriate section. I am rather new to HTML and Javascripting and am currently developing an Intranet Webpage. On one of the pages, I am required to update the contents of the webpage using a .csv file which will be uploaded to the server on a daily basis. I have learnt that it is possible to update the contents using "Tabular Data Control" to display the contents and update it regularly. I am also reuqired to change an images according to content in the table. However, I am only able to retrieve the first row the the table and therefore would like some assistance to help retrieve the subsequent rows. Here are my codes: Codes for the .csv/.txt files Code: Name,Status Item #1,Completed Item #2,Pending Item #3,Not Started Item #4,Completed Item #5,Completed Item #6,Pending HTML codes: Code: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title>Untitled Document</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head> <body onLoad="loadStatus()"> <script type="text/javascript"> function loadStatus(){ var textField = document.getElementById("test").innerText alert(textField); if(textField == "Completed") { document.getElementById("pic").src = '/images/completed.jpg'; } else if (textField == "Pending") { document.getElementById("pic").src = '/images/on-going.jpg'; } else if (textField == "Not Started") { document.getElementById("pic").src = '/images/not_started.jpg'; } } </script> <OBJECT ID="data" CLASSID="CLSID:333C7BC4-460F-11D0-BC04-0080C7055A83"> <PARAM NAME="DataURL" VALUE="test.txt"> <PARAM NAME="UseHeader" VALUE="true"> </OBJECT> <table border="1" bordercolor="#000000" cellpadding="0" datasrc="#data" > <THEAD><TR> <TBODY> <TR> <TD><img src="" width="14" height="14" id="pic"></TD> <TD><div datafld="Name"></div></TD> <TD id="test"><span datafld="Status"></span></TD></TR> </TBODY> </TABLE> </body> </html> I have thought of adding 6 different <object> and 6 <span> using filter to filter each object according to their name. But it would be very messy and would make the page bigger in size. I hope you guys can help me. Thanks in advance. Cheers, Jermms I am trying to allow the user to type in two numbers and then a multiplication table pops up below it. It works however I cannot figure out how to make the first row be 0,1,2,3,4,5..ect and same for the first column in each row going down the table. Here is my code.. Code: <html> <head> <title>Untitled</title> <script> function f(x,y) { if((x < 3) || (y < 3) || (x > 10) || (y > 10)){ alert("Please enter numbers between 3 and 7") }else{ s = "<table border = '1'>" var total; for (i=0; i<=x; i++){ s+= "<tr></tr>"; for (j=0; j <= y; j++){ total = i * j; s+="<td>"+ total +"</td>" } } s+="</table>" document.getElementById("Q").innerHTML+=s } } </script> </head> <body> [enter a number between 3 and 10] <form id = "form1"> <input id = "a" value = "6"> by <input id = "b" value = "8"><br> <input type = "button" onclick = "f(a.value,b.value)" value = "Click here when ready!"> <br> </form> <div id = "Q"></div> </body> </html> Hi to All, I have this problem: I' dl ike that, if one clicks a button, appear window_explorer in which it' s possible to choose an image that it will put in the specific td of the table. <head> <script> function add_pic() { document.forms[0].pic.value == code to choose image ... } </script> </head> <body> <form method="POST" name="FrontPage_Form1"> ... <table> <tr><td><button onClick="add_pic()">Insert Statitistic map</button></td></tr> <tr><td>Comments</td></tr> <tr><td id="pic" name="pic"> PLACE IN WHICH IMAGE APPEAR </td></tr> </table> ... </body> Thanks in advance !!! P.S. I use IE6 and Windows XP Hello everyone. I want to move my image through table cells by using arrow buttons. Code: <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>Move</title> <style type="text/css" > table { background-color:#FFCC00; margin-top: 100px; margin-bottom: 100px; } </style> </head> <body onload="setup()"> <script type="text/JavaScript" onkeydown="handleKey(event)"> document.write('<table border="1" cellspacing="0" cellpadding="10">'); var count =0 for (var row=0; row<20; row++) { document.write('<tr>'); for (var col=0; col<20; col++) { idnmr = count count++ document.write('<td style="border:0"; id="idnmr";>'); document.write('</td>'); } document.write('</tr>'); } function setup() { row=0; col=0; insertKnight(row,col); } function handleKey(e) { if (typeof e !='object') e=window.event; if (e.type == 'keydown' && (e.keyCode ==27 || (e.keyCode >= 37 && e.keyCode <=40))) { switch (e.keycode) { case 37: dC= -1; dR = 0; break; case 38: dC= +1; dR=0; break; case 39: dC = 0; dR = +1; break; case 40: dC= 0; dR=-1; break; } emptyCell(row,col); function emptyCell(row,col) { var id = 'r' + row + 'c' + col; var cell= document.getElementById(id); if(cell) cell,innerHTML=''; } row +=dR; col +=dC; //insert image insertKnight(row,col); return false; function insertKnight(row,col) { var id = 'r' + row + 'c' + col; var cell = document.getElementById(id); var colour = cell.className; if (colour != 'white') { var knight='cherry.png'; } else { var knight= 'cherry.png'; function eraseImage(row,col) { var id = 'r' + row + 'c' + col; document.getElementById(id).innerHTML = ''; } cell.innerHTML = '<img src=" ' + knight + ' " alt="' + colour + 'knight" />'; } document.getElementById('debug').innerHTML = 'r='+row+' c='+col; function drawImage(row,col) { var id = 'r' + row + 'c' + col; document.getElementById(id).innerHTML = '<img src="cherry.png"/>'; } </script> </body> </html> This is my code. Now i have problems with the eraseImage and drawImage functions. They just don't work. Any help will be appreciated. Thank you OK, so I have this table I am putting on a new website I am building. The table works great. Does exactly what I want it to do, except for one thing. Here's the code for the table: <html> <head> <script type="text/javascript" src="https://www.google.com/jsapi"></script> <script type="text/javascript"> google.load("visualization", "1", {packages:["table"]}); google.setOnLoadCallback(drawTable); function drawTable() { var data = new google.visualization.DataTable(); data.addColumn('string', 'Artist'); data.addColumn('string', 'Title'); data.addColumn('string', 'Song #'); data.addRows([ ['Colin Hay', 'Overkill (Men at Work Acoustic)', 'GKK-02'], ['Colin Hay', 'Waiting for My Real Life to Begin', 'GKK-01'], ['Lindsey Buckingham', 'Big Love (Fleetwood Mac Acoustic)', 'GKK-03'] ]); var table = new google.visualization.Table(document.getElementById('table_div')); table.draw(data, {showRowNumber: true}); } </script> </head> <body> <div id="table_div"></div> </body> </html> Now, here's the problem. In the third column, I need to insert a unique hyperlink for each song # in each row. When I try to add a hyperlink, it shows the code instead of a link. I am a coding NOVICE. Everything I know, I have taught myself. The solution to this is escaping me. Please help? Reply With Quote 12-31-2014, 02:11 AM #2 CanYouDigIt View Profile View Forum Posts New Coder Join Date Dec 2014 Posts 14 Thanks 1 Thanked 0 Times in 0 Posts Also.... forum admin.... please edit my typo in the thread title so I don't look like more of an idiot than I actually am. Thanks. Reply With Quote 12-31-2014, 03:37 AM #3 Kharahs View Profile View Forum Posts New to the CF scene Join Date Dec 2014 Posts 2 Thanks 0 Thanked 0 Times in 0 Posts I'm fairly new to javascript (but have quite a bit of experience working with HTML and CSS - also self taught) so I could be misunderstanding, but are you using something along the lines of... Code: <a href="http://etcetc.com">Text you want the hyperlink applied to</a> ...for the hyperlink? Reply With Quote 12-31-2014, 03:39 AM #4 CanYouDigIt View Profile View Forum Posts New Coder Join Date Dec 2014 Posts 14 Thanks 1 Thanked 0 Times in 0 Posts Originally Posted by Kharahs I'm fairly new to javascript (but have quite a bit of experience working with HTML and CSS - also self taught) so I could be misunderstanding, but are you using something along the lines of... Code: <a href="http://etcetc.com">Text you want the hyperlink applied to</a> ...for the hyperlink? Exactly correct. But that code is not functioning inside the javascript for the table. Reply With Quote 12-31-2014, 04:18 AM #5 Kharahs View Profile View Forum Posts New to the CF scene Join Date Dec 2014 Posts 2 Thanks 0 Thanked 0 Times in 0 Posts Create link in an html table with javascript - Stack Overflow - looks like a similar issue? One of the responses may have a clue Reply With Quote 12-31-2014, 04:31 AM #6 low tech View Profile View Forum Posts Regular Coder Join Date Dec 2009 Posts 905 Thanks 177 Thanked 104 Times in 104 Posts Hi I haven't worked with this before but something like this maybe as an example would produce links on song column example link <a href="http://www.example.com/GKK-01">GKK-01</a> PHP Code: <div id="table_div"></div> <script type="text/javascript" src="https://www.google.com/jsapi"></script> <script type="text/javascript"> google.load("visualization", "1", {packages:["table"]}); google.setOnLoadCallback(drawTable); function drawTable() { var data = new google.visualization.DataTable(); data.addColumn('string', 'Artist'); data.addColumn('string', 'Title'); data.addColumn('string', 'Song #'); data.addRows([ ['Colin Hay', 'Overkill (Men at Work Acoustic)', 'GKK-02'], ['Colin Hay', 'Waiting for My Real Life to Begin', 'GKK-01'], ['Lindsey Buckingham', 'Big Love (Fleetwood Mac Acoustic)', 'GKK-03'] ]); var table = new google.visualization.Table(document.getElementById('table_div')); var formatter = new google.visualization.PatternFormat( '<a href="http://www.example.com/{1}">{0}</a>'); // Apply formatter and set the formatted value of the first column. formatter.format(data, [2, 2]); //table.draw(data, {showRowNumber: true}); table.draw(data, {allowHtml: true, showRowNumber: true}); } </script> Hi, I'm new to Javascript and need to help with something, I'll try and explain this as best as I can but feel free to ask questions if it doesn't make sense. I'm basically building a javascript/html calculator but I need the calculation to appear gradually in a table, the table need to be 3 columns accross and add a row each time a calculation button is pressed, the first column can remain blank for now but will need to contain a text field eventually, second column needs to show the calculation symbol, third column shows the number. Here's an example: 4+2+7-5=8 |Blank| | 4 | |Blank| + | 2 | |Blank| + | 7 | |Blank| - | 5 | |Blank| = | 8 | Here's the code I have so far so you can get a feeling of what it looks like, this table need to go into the area div and will replace what is currently the Code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Sample Widget</title> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <link href="basic.css" rel="stylesheet" type="text/css" /> <script type="text/javascript" src="basic.js"></script> <meta name="generator" content="Nokia WRT extension for Visual Studio 2.0" /> <script type="text/javascript" language="javascript"> function UpdateInput(a, b) { var MyElement = document.getElementById("Input"); MyElement.innerHTML = MyElement.innerHTML + a; var MyElement = document.getElementById("Area"); MyElement.innerHTML = MyElement.innerHTML + b; } function Calculate() { var result = eval(document.getElementById("Input").innerHTML); var total = document.getElementById("Total"); total.innerHTML = result; var MyElement = document.getElementById("Area"); MyElement.innerHTML = MyElement.innerHTML + '<br>=' + result; } </script> </head> <body onLoad="init()"> <div id="Main"> <table cellpadding="0" cellspacing="0" width="100%"> <div id="Area"> </div> </table> <table cellpadding="0" cellspacing="0" width="100%"> <tr> <td class="style1">Total:</td> <td> <div id="Total"></div> </td> </tr> <tr> <td colspan="2"> <div id="Input"></div> </td> </tr> </table> <table cellpadding="0" cellspacing="0"> <tr> <td><img src="Images/plus.png" onclick="UpdateInput('+','<br>+')" /></td> <td><img src="Images/minus.png" onclick="UpdateInput('-','<br>-')" /></td> <td><img src="Images/times.png" onclick="UpdateInput('*','<br>*')" /></td> <td><img src="Images/divide.png" onclick="UpdateInput('/','<br>/')" /></td> </tr> <tr> <td><img src="Images/7.png" onclick="UpdateInput(7,7)" /></td> <td><img src="Images/8.png" onclick="UpdateInput(8,8)" /></td> <td><img src="Images/9.png" onclick="UpdateInput(9,9)" /></td> <td><img src="Images/percent.png" onclick="UpdateInput('%','<br>%')" /></td> </tr> <tr> <td><img src="Images/4.png" onclick="UpdateInput(4,4)" /></td> <td><img src="Images/5.png" onclick="UpdateInput(5,5)" /></td> <td><img src="Images/6.png" onclick="UpdateInput(6,6)" /></td> <td><img src="Images/oneoverx.png" /></td> </tr> <tr> <td><img src="Images/1.png" onclick="UpdateInput(1,1)" /></td> <td><img src="Images/2.png" onclick="UpdateInput(2,2)" /></td> <td><img src="Images/3.png" onclick="UpdateInput(3,3)" /></td> <td><img src="Images/plusminus.png" /></td> </tr> <tr> <td><img src="Images/0.png" onclick="UpdateInput(0,0)" /></td> <td><img src="Images/dot.png" onclick="UpdateInput('.','.')" /></td> <td><img src="Images/equals.png" onclick="Calculate()" /></td> <td><img src="Images/sub.png" /></td> </tr> </table> </div> </body> </html> Hello Everyone, I'm new to JavaScript and I need some help, What I'm trying to do is type a background color for the content area of a table by using the prompt box. This is the code I had but it didn't work: <html> <head><title>Practice</title> <script type="text/javascript"> //content color var table = prompt("Choose a color for the content area", "white "); document.write("<table BGCOLOR=" + table + " >"); </script> </head> <body bgcolor="black"> <table bgcolor="" width="600px" height="600px" cellpadding="15" border="0" align="center"> <!-- ============ HEADER ============== --> <tr> <td height="35px" colspan="2" align="center"><p align="center"><a href="http://www.youtube.com/">YouTube</a> | <a href="http://www.facebook.com/">Facebook</a> | <a href="http://www.twitter.com/">Twitter</a> | <a </td></tr> <!-- ============ LEFT COLUMN (CONTENT) ============== --> <tr> <td rowspan="6" width="500" valign="top"><td></tr> <input type="file" onclick="disp_prompt()" value="Display a prompt box" /> <script type="text/javascript"> var <!-- ============ RIGHT COLUMN ============== --> <tr><td width="174px" valign="top"> </td></tr> <!-- ============ FOTTER ============== --> <tr> <td height="35px" colspan="2" align="center"> </td></tr> </body> </html> Here's the code a friend gave me but it didn't work either: <script type="text/javascript"> var contentbg = prompt("What background color would you like your content to be?", "White"); document.write("<table align=\"center\" border=\"1\" cellpadding=\"15\" width=\"600\" height=\"600\" bgcolor=\"" + contentbg + "\">"); </script> Please! help me out. Thanks. |