Image and cell spacing in javascript built table - javascript

First let me start by saying I am very new to javascript. I am currently studying the subject as part of a course I am doing.
I have an assignment that requires me to put together image slices in a table built by javascript and place it in a on a HTML page.
I have had success with all of this except when i attempt to resize the table and div section with CSS the images separate leaving gaps in the image. Is there anyone out there who can see why i am getting this issue? Im pulling my hair out.
here is my code.
HTML
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Bazaar Ceramics</title>
<!--[if IE]>
<link type="text/css" rel="stylesheet" media="all" href="ie_only.css"/> <![endif]-->
<link href="../../CSS/ie_only.css" rel="stylesheet" type="text/css">
<link href="../../CSS/laptop.css" rel="stylesheet" type="text/css">
<link href="../../CSS/Layout.css" rel="stylesheet" type="text/css">
<link href="../../CSS/mobile.css" rel="stylesheet" type="text/css">
<link href="../../CSS/style.css" rel="stylesheet" type="text/css">
<link href="../../CSS/tablet.css" rel="stylesheet" type="text/css">
</head>
<body>
<div id="mainwrapper">
<div id="header"><img id="logo" src="../../images/bazaar-logo.jpg" alt="Bazaar Ceramics Logo"><h1 class="title">Bazaar Ceramics</h1>
</div><!--this is the end of div Header-->
<div id="ImageContent"><script src="../../Script/ImageContent.js"> </script></div><!--this is the end of div id ImageContent-->
<div id="formContent">
<h1 class="prodhead">Order Item</h1>
<form action="#" name="orders">
<table id="formtab">
<tr>
<td width="20%"><label>Item Description:</label></td> <td><input type="text" name="description" size="100%" value="Red Bowl" disabled></td>
</tr>
<tr>
<td><label>Quantity:</label></td><td><input type="text" name="quantity" value="1" min="1"></td>
<tr>
<td><label>Price:</label></td><td><input type="text" name="price" value="$350" disabled></td>
</tr>
<tr>
<td><label>Total Price:</label></td><td><input type="text" name="total"></td>
</tr>
<tr>
<th colspan="2"><input type="button" name="clear" value="Clear Form" id="button"> <input type="button" name="calculate" value="Calculate Total" id="button"> <input type="button" name="Submit" value="Submit Order" id="button"></th>
</table>
</form>
</div><!--this is the end of div id formContent-->
<div id="footer">
Home
Close
<br style="clear:both"><p id="copyright">Copyright 2018 Online System Solutions</p></div><!--this is the end of dive id footer-->
</div><!--end of mainwrapper-->
</body>
</html>
CSS Code
.myTable {
max-width:90%;
}
.myImg{
display:block;
max-width: 100%;
height: auto;
width: auto;
vertical-align:middle;
}
javascript
// constants
var colCount=5;
var rowCount=4;
// input data
var col1 = new Array("r1_c1","r2_c1","r3_c1","r4_c1");
var col2 = new Array("r1_c2", "r2_c2", "r3_c2", "r4_c2");
var col3 = new Array("r1_c3", "r2_c3", "r3_c3", "r4_c3");
var col4 = new Array("r1_c4", "r2_c4", "r3_c4", "r4_c4");
var col5 = new Array("r1_c5", "r2_c5", "r3_c5", "r4_c5");
// create the column array.
var collist = [col1,col2,col3,col4,col5];
// make the table.
document.write('<table class="myTable" cellspacing="0" cellpadding="0" align="center">');
for (rownum = 1; rownum <= rowCount; rownum++) {
document.write("<tr>");
for (colnum = 1; colnum <= colCount; colnum++) {
document.write("<td>" + '<img src="../../images/Large/bcpot002_' + (collist[(colnum-1)])[(rownum-1)] + '.jpg"' + 'class="myImg">' + '</img>' + "</td>");
}
document.write("</tr>");
}
document.write('</table>')
Any help here would be great thanks.

Related

How to add rows using JavaScript? [duplicate]

This question already has answers here:
How to insert a row in an HTML table body in JavaScript
(13 answers)
Closed 1 year ago.
I recently started to code and I'm trying to build an expense application using HTML, CSS, and JavaScript. I'm creating a replica of this photo
Here is my HTML:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<link rel="stylesheet" type="text/css" href="css/style.css">
<title>Expense Tracker</title>
</head>
<body>
<h1>Expense Tracker</h1>
<div id="myDiv">
<label for="name">Name:</label>
<input type="text" name="myInput" id="myInput" placeholder="Name of expense" size="50"><br><br>
<label for="date">Date:</label>
<input type="date" id="myDate" name="myDate">
<label for="amount">Amount:</label>
<input type="text" name="myAmount" id="myAmount" placeholder="Dollar amount ($)"><br><br>
<span onclick="addRow()" class="addBtn">Add Expense</span>
</div>
<br>
<table id="myTable">
<tr>
<th>Name</th>
<th>Date</th>
<th>Amount</th>
<th>Delete</th>
</tr>
<tr>
<td>McDonald's</td>
<td>6/22/2017</td>
<td>$12.00</td>
<td><input type="button" value="Delete" onclick="deleteRow(this)"></td>
</tr>
</table>
<script src="script.js"></script>
</body>
</html>
Here is my JavaScript, so far:
function deleteRow(r) {
var i = r.parentNode.parentNode.rowIndex;
document.getElementById("myTable").deleteRow(i);
}
How do I add additional rows using JavaScript? I can delete rows, using the JavaScript code above, but I am having a hard time figuring out how to add new elements.
You will need to do this via DOM manipulation.
Something like this should work...
<button type="button" onclick="myFunction()">New row</button>
function myFunction() {
var table = document.getElementById("myTable");
var row = table.insertRow(0);
var cell1 = row.insertCell(0);
var cell2 = row.insertCell(1);
cell1.innerHTML = "NEW CELL1";
cell2.innerHTML = "NEW CELL2";
}

how to call java script on new created html table row [duplicate]

This question already has answers here:
What is DOM Event delegation?
(10 answers)
Closed 4 years ago.
I have a table in which an input control calls a java script event
oninput="this.value=this.value.replace(/[^0-9]/g,'');
By Clicking on Add Row new Row is being inserted but i want to call this event on new row as well . This event is to stop except positive whole numbers
using the following code.
<html>
<head>
<link rel="stylesheet" href="https://code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
<script src="https://code.jquery.com/jquery-1.12.4.js"></script>
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/7.0.0/normalize.css" />
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" integrity="sha384-wvfXpqpZZVQGK6TAh5PVlGOfQNHSoD2xbE+QkPxCAFlNEevoEH3Sl0sibVcOQVnN" crossorigin="anonymous">
</head>
<body>
<input type="hidden" id="minsize" value="1">
<div class="">
<table id="mintable" class="table table-bordered table-striped stripe hover row-border">
<thead class="div-head">
<tr>
<th><b>Roll No</b></th>
</tr>
</thead>
<tbody>
<tr>
<td><input type="text" id='rollno0' oninput="this.value=this.value.replace(/[^0-9]/g,'');" class="form-control"></td>
</tr>
</tbody>
</table>
<input type="hidden" name="minRows" id="minRows" value='1'>
<input type="hidden" id="sizemin" name="sizemin" value='1' />
</div>
<input type="submit" data-toggle="tooltip" title="Insert new horizon
" data-placement="top" class="btn btn-primary" id="button" value="Add Row" onClick="addRow()" />
<script>
function addRow() {
var table = document.getElementById("mintable");
var rowCount = parseInt(document.getElementById("minRows").value);
var rowInsert = parseInt(document.getElementById("sizemin").value);
var row = table.insertRow(rowInsert + 1);
var cell1 = row.insertCell(0);
var element1 = document.createElement("input");
element1.type = "text";
element1.id = "rollnoo" + (rowCount);
element1.className = "form-control";
cell1.appendChild(element1);
rowCount = parseInt(rowCount)+ 1;
document.getElementById("minRows").value = rowCount;
document.getElementById("sizemin").value =
parseInt(document.getElementById("sizemin").value) + 1;
}
</script>
</body>
</html>
Try the following syntax to add event handler to newly created element:
element1.oninput = function() {
this.value = this.value.replace(/[^0-9]/g,'');
}
<html>
<head>
<link rel="stylesheet" href="https://code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
<script src="https://code.jquery.com/jquery-1.12.4.js"></script>
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/7.0.0/normalize.css" />
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" integrity="sha384-wvfXpqpZZVQGK6TAh5PVlGOfQNHSoD2xbE+QkPxCAFlNEevoEH3Sl0sibVcOQVnN" crossorigin="anonymous">
</head>
<body>
<input type="hidden" id="minsize" value="1">
<div class="">
<table id="mintable" class="table table-bordered table-striped stripe hover row-border">
<thead class="div-head">
<tr>
<th><b>Roll No</b></th>
</tr>
</thead>
<tbody>
<tr>
<td><input type="text" id='rollno0' oninput="this.value=this.value.replace(/[^0-9]/g,'');" class="form-control"></td>
</tr>
</tbody>
</table>
<input type="hidden" name="minRows" id="minRows" value='1'>
<input type="hidden" id="sizemin" name="sizemin" value='1' />
</div>
<input type="submit" data-toggle="tooltip" title="Insert new horizon
" data-placement="top" class="btn btn-primary" id="button" value="Add Row" onClick="addRow()" />
<script>
function addRow() {
var table = document.getElementById("mintable");
var rowCount = parseInt(document.getElementById("minRows").value);
var rowInsert = parseInt(document.getElementById("sizemin").value);
var row = table.insertRow(rowInsert + 1);
var cell1 = row.insertCell(0);
var element1 = document.createElement("input");
element1.type = "text";
element1.id = "rollnoo" + (rowCount);
element1.className = "form-control";
element1.oninput = function() {
this.value = this.value.replace(/[^0-9]/g,'');
}
cell1.appendChild(element1);
rowCount = parseInt(rowCount)+ 1;
document.getElementById("minRows").value = rowCount;
document.getElementById("sizemin").value =
parseInt(document.getElementById("sizemin").value) + 1;
}
</script>
</body>
</html>

Is there a way to bypass a router login screen?

I was challanged recently to "hack" into my router, by that I mean already having connected to the internet, but hack into the local IP. So basically bypass the login screen. The router is a Livebox. I already have tried looking at the source code but the password seems to be hidden.
Here's a picture of the login screen.
If you can help than thank you very much.
Oh by the way, here's the source code:
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<script language="JavaScript">
var remote_clt=0;
var sipp_proxy_flag=1;
var pcp_gui_enable=1;
var nat_from_upnp=1;
var my_auto_detect_fxo=0;
var my_isolate_wlan=1;
var X02_pf=1;
var adsl_para_page=0;
var my_ddns=1;
var my_wlan_mac=0;
var my_snmp=0;
var my_dialup=0;
var my_printer=0;
var my_bridge=0;
var my_8021x=0;
var my_tiny=0;
var my_vpn=0;
var my_upnp=1;
var my_usb=1;
var my_usb_storage=1;
var my_usb_printer=1;
var operation_func=10;
var my_wps=1;
var my_wcn=1;
var my_ralink_ver=0;
var feature_func=1;
var product_code=1024020;
var my_file_share=1;
var my_umts=0;
var vlan_func_enable=1;
var vlan_ip="";
var vlan_mask="";
var my_qos=2;
var my_isdn=0;
var my_voip=1;
var FXS_Num=8;
var my_voip_h323=0;
var my_voip_sip=1;
var ipsec_func=0;
var pptp_func=0;
var br_dhcpd_func=0;
var iptv_func=0;
var static_rt_func=0;
var my_upnpIgd=1;
var my_upnpAv=1;
var PM="DSL Router";
var BACKUP_LOG_NAME="dsl_log.log";
var BACKUP_CONFIG_NAME="config_dsl.bin";
var resetButton=0;
var hasUpgrade=0;
var ftpcRun=0;
var dhcpd_fixip_func=1;
var vendor_code=6;
var my_http_redir=0;
var arcor_umtsPin=0;
var my_ncidd=0;
var ipv6_service=1;
var ipv6_enable=1;
var hyper_link="<a href='http://www.arcadyan.com' target='_blank'>";
var urlname="www.arcadyan.com";
var product_name="Arcadyan ARV7519";
var vendor_name="DSL-EasyBox";
var company="Arcadyan Inc.";
var mouseover="'#FF6600'";
var mouseout="'#FFFFFF'";
var wizardbg="'#FFFFFF'";
var menu_link="<td height='0' align='left' bgColor='#FFFFFF' valign='middle'>";
var vendor_no=2;
var helplink="<p></p>";
var logo_fn="logo.gif";
var help_hyper_link="<a href='http://www.arcadyan.com/802' target='_blank'>";
var help_urlname="www.arcadyan.com/802";
var fw_hyper_link="<a href='http://www.arcadyan.com' target='_blank'>";
var fw_urlname="www.arcadyan.com";
var product_pic_fn="product_zz.gif";
var firmware_ver='00.96.806B';
if (parent.location.href != window.location.href)
parent.location.href = window.location.href;
function evaltF() {
document.tF.submit();
}
function kDown(e)
{
var key = 0 ;
if(window.event) key = window.event.keyCode;
else if(e) key = e.which ;
if(key==13) document.tF.submit();
//if (navigator.appName =='Netscape'&&(e.which ==3||e.which ==2|| e.which ==13))
// document.tF.submit();
//else if (navigator.appName == 'Microsoft Internet Explorer' &&(event.keyCode == 13))
// document.tF.submit();
}
document.onkeypress=kDown;
if (document.layers) window.captureEvents(Event.KEYDOWN);
//window.onkeypress=kDown;
function init()
{
var f=document.tF;
f.pws.focus();
if(remote_clt==1)
f.user.readOnly=false;
}
</script>
<link rel="stylesheet" type="text/css" href="fonts.css">
<link rel="stylesheet" type="text/css" href="page.css">
<link rel="stylesheet" type="text/css" href="menu.css">
<link rel="stylesheet" type="text/css" href="header.css">
<link rel="stylesheet" type="text/css" href="contener.css">
<link rel="stylesheet" type="text/css" href="subcontener.css">
<link rel="stylesheet" type="text/css" href="array.css">
<link rel="stylesheet" type="text/css" href="hardware.css">
<link rel="stylesheet" type="text/css" href="button.css">
<link rel="stylesheet" type="text/css" href="lbpopup.css">
<link rel="stylesheet" type="text/css" href="progressbar.css">
<link rel="stylesheet" type="text/css" href="styles.css">
<style type="text/css">
.style1 {
text-align: right;
}
</style>
</head>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<table border="0" cellpadding="0" cellspacing="0" width="97%" height="83">
<tr height="55">
<form ACTION="/cgi-bin/changef.exe" method="post" name="tFF">
<input type="hidden" name="language_flag" value="0">
<input type="hidden" name="menupage" value="/login.stm">
<td class="header" width="313"><div id="header"><h4>livebox</h4></div></td>
<td class="style1">
<img src="/images/language_en_gray.gif" width="70" height="29" border="0">
<input type="image" src="/images/language_es.gif" width="70" height="29" border="0">
</td>
</form>
</tr>
<tr>
<td class= bgstripe height="28" colspan="2"> </td>
</tr>
</table>
<form action="/cgi-bin/login.exe" method="post" name="tF">
<div id="menu" style="margin-left: 40%; margin-top: 60px;">
<table>
<tr>
<td class="topleft"></td>
<td class="top"></td>
<td class="topright"></td>
</tr>
<tr>
<td class="left"></td>
<td>
<div class="info_accueil">
<table class="info_accueil">
<tr>
<td class="info_pref"><img src="images/preferencesbutton.gif">Authentication</td>
</tr>
<tr>
<td class="info_label">Login:</td>
</tr>
<tr>
<td class="info_field"><input type="text" name="user" value="admin" class="login" readonly></td>
</tr>
<tr>
<td class="info_label">Password:</td>
</tr>
<tr>
<td class="info_field"><input type="password" maxlength="12" size="32" name="pws" class="password"></td>
</tr>
<tr>
<td class="info_statusnok"> </td>
</tr>
</table>
</div>
</td>
<td class="right"></td>
</tr>
<tr>
<td class="sepleftbig"></td>
<td class="sepactbig">
Click here to validate <img src="images/nextbutton.gif" border="0"></td>
<td class="right"></td>
</tr>
<tr>
<td class="bottomleft"></td>
<td class="bottom"></td>
<td class="bottomright"></td>
</tr>
<tr><td colspan=3></td></tr>
<tr><td colspan=3></td></tr>
</table>
</div>
</form>
<br><br><br>
<p>
<style type="text/css">
p { text-align:center;
font-size:20;
color: #FF6600;
}
a {
color: #FF6600;
font-weight: bold;
text-decoration: underline;
}
A:link {text-decoration: underline color: #FF6600;}
A:visited {text-decoration: underline color: #FF6600;}
A:active {text-decoration: underline color: #FF6600;}
A:hover {text-decoration: underline; color: #FF6600;}
</style>
<a href="http://www.orange.es/livebox/apps">
Here please download the Livebox Apps for your Smartphone
</a>
</p>
<p>
<a href="http://www.orange.es/livebox/apps">
<img src="/images/QR_code.png">
</a>
</p>
<script language="JavaScript">
init();
</script>
</body>
</html>
I think this link will help you understand how brute-force works and I hope it will guide you the right way
As far as I can tell (and I may be wrong), when you log into a router, it is like logging into a computer remotely.
That means you can automatically cross XSS, MySQL injection, and any other form of web hacking. There may be a script that you can plug directly into the USB port of your router to effectively hack it or just brute force your way in.
I am not a hacker by any means so anything you read here is merely educated guesses.
Hope I helped.

How to get text from the form and save in text file using javascript?

How to get text from the form and save in text file using javascript
<html >
<head>
<link rel="shortcut icon" type="image/png" href="/favicon1.png" sizes="16x16" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Login & Registration System</title>
<link rel="stylesheet" href="style.css" type="text/css" />
</head>
<body>
<center>
<div id="login-form">
<form method="post">
<table align="center" width="30%" border="0">
<tr>
<td><font color="#001c4e" size=18px >
<b>Elvis Login</b></font></td>
</tr>
<tr>
<td><input type="text" id="resultname" name="user_name" placeholder="User ID" required /></td>
</tr>
<tr>
<td><input type="password" name="pass" placeholder="Your Password" required /></td>
</tr>
<div id="result"></div>
<script>
// Check browser support
function WriteToFile(f) { //added the form you clicked from
try {
alert("started");
var t = f.user_name.value;
alert(t);
var msg = t;
var fso, s;
fso = new ActiveXObject("Scripting.FileSystemObject");
s = fso.OpenTextFile("C:\\Test\\Logfile.txt", 8, false);
s.writeline(msg);
s.Close();
alert("Comment Saved!");
}
catch (err) {
var strErr = 'Error:';
strErr += '\nNumber:' + err.number;
strErr += '\nDescription:' + err.description;
document.write(strErr);
}
}
$</script>
<tr>
<td><button type="submit" onclick="WriteToFile(this.form)" name="btn-login">Sign In</button></td>
</tr>
</table>
</form>
</div>
</center>
</body>
</html>
I need get the username from form and save it in the text file.But this code only works in the IE browser.please give suggestions.
what are the things used insteadof new ActiveXObject??
I am not interested to install the plugins.give others suggestions please

Reprinting Form input in html

So I am designing a website for myself, which takes a user input from the user through a form, searches for the same in database , and returns the expected output.
Below shown is my HTML Code for the same.
<%# page import="java.sql.*"%>
<%# include file="DBConn.jsp" %>
<%# page import = "java.sql.*"%>
<%
String ID,time,result,obj;
Statement stmt,stmt2;
ResultSet rs;
String SQL="";
String k="key";
String w="wallet";
String p="pen";
String a="atm";
ID="";
time="";
result="";
String save=request.getParameter("bSave");
String delete=request.getParameter("BDelete");
String search=request.getParameter("BSearch");
stmt = con.createStatement();
if (search!=null)
{
obj=request.getParameter("ID");
if(obj.equals(k))
{
ID="05447646";
}
else if(obj.equals(w))
{
ID="05447647";
}
else if(obj.equals(p))
{
ID="05447649";
}
else if(obj.equals(a))
{
ID="05447650";
}
rs=stmt.executeQuery("Select * from tablename1 where ID='"+ ID +"'");
while(rs.next()) {
ID=rs.getString("ID");
time=rs.getString("time"); }
}
%>
<!DOCTYPE HTML>
<html>
<head>
<title>Intelli-Track Search Interface</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<meta name="description" content="" />
<meta name="keywords" content="" />
<link href="1.css" rel="stylesheet" />
<style type="text/css">
#Head1{
position: absolute;
width: 100%;
top: 126px;
visibility: visible;
left: 4px;
}
#tab1 {
position: absolute;
width: 780px;
height: 408px;
z-index: 1;
left: 1px;
top: 272px;
right: auto;
}
#apDiv1 {
position: absolute;
width: 403px;
height: 408px;
z-index: 1;
left: auto;
top: 200px;
right: -1px;
}
.center1 {
text-align: center;
}
#apDiv1 .indent-1 {
text-align: center;
font-size: 44px;
}
#apDiv1 p {
text-align: center;
}
</style>
<script src="js/jquery-1.8.3.min.js"></script>
<script src="css/5grid/init.js?use=mobile,desktop,1000px"></script>
<script src="js/init.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$("#login_frm").submit(function(){
//remove previous class and add new "myinfo" class
$("#msgbox").removeClass().addClass('myinfo').text('Validating Your Login ').fadeIn(2000);
this.timer = setTimeout(function () {
$.ajax({
url: 'check.jsp',
data: 'un='+ $('#login_id').val() +'&pw=' + $('#password').val(),
type: 'post',
success: function(msg){
if(msg != 'ERROR') // Message Sent, check and redirect
{ // and direct to the success page
$("#msgbox").html('Login Verified, Logging in.....').addClass('myinfo').fadeTo(900,1,
function()
{
//redirect to secure page
document.location='login.jsp?user='+msg;
});
}
else
{
$("#msgbox").fadeTo(200,0.1,function() //start fading the messagebox
{
//add message and change the class of the box and start fading
$(this).html('Sorry, Wrong Combination Of Username And Password.').removeClass().addClass('myerror').fadeTo(900,1);
});
}
}
});
}, 200);
return false;
});
});
</script>
<noscript>
<link rel="stylesheet" href="css/5grid/core.css" />
<link rel="stylesheet" href="css/5grid/core-desktop.css" />
<link rel="stylesheet" href="css/5grid/core-1200px.css" />
<link rel="stylesheet" href="css/5grid/core-noscript.css" />
<link rel="stylesheet" href="css/style.css" />
<link rel="stylesheet" href="css/reset.css" />
<link rel="stylesheet" href="css/structure.css" />
<link rel="stylesheet" href="css/style-desktop.css" />
</noscript>
<!--[if lte IE 9]><link rel="stylesheet" href="css/ie9.css" /><![endif]-->
<!--[if lte IE 8]><link rel="stylesheet" href="css/ie8.css" /><![endif]-->
<!--[if lte IE 7]><link rel="stylesheet" href="css/ie7.css" /><![endif]-->
</head> <body>
<form name="form1" method="post" action="">
</form>
<nav id="nav">
<ul>
<li>Home</li>
<li>About Intelli-Track</li>
<li>Logout</li>
<li>Contact</li>
</ul>
</nav>
<div class="image-centered" id="Head1">
<header> <h1 align="center">Welcome to <strong>Intelli-Track</strong> Search Interface</h1><hr>
</header>
</div>
<div id="tab1">
<table align="center" width="800" style="border:10px solid #d2d2d2">
<tr><th align="center"><h3><u>Object</u></h3></th><th width="234" align="center"><h3><u>Tag-ID</u></h3></th>
<th width="394" align="center"><h3><u>Last Accessed Date and Time</u></h3></th></tr>
<tr></tr>
<tr><td align="center"><script type="text/javascript">
</script>
</td><td align="center"><%=ID%></td>
<td align="center"><%=time%></td>
</tr>
</table>
</div>
<div id="apDiv1">
<p> </p>
<h3 class="indent-1"> <span class="center1">Object Finder</span> </h3>
<form name="form2" width=70% method="post" action="">
<p>
<label for="ID">Enter object to be searched:</label>
</p>
<p>
<input type="text" name="ID" id="IDd">
</p>
<p>
<input name="BSearch" type="submit" class="button-big" value="Search">
</p>
</form>
<p> </p>
</div>
</body>
</html>
This is what the actually page looks like :
So what does this page basically do is , when a user enter a value in the form ( The valid values are pen,key,atm,wallet), it retrieves the last time of the pen access and the TAG_ID, which is already stored in the database. While I can easily retrieve these two values. I do not know how to print the name of the object in the first column "OBJECT", again it should print valid OBJECT (like pen, wallet, atm, key)
What should i put here in this part of the code, to achieve the same. :
<table align="center" width="800" style="border:10px solid #d2d2d2">
<tr><th align="center"><h3><u>Object</u></h3></th><th width="234" align="center"><h3><u>Tag-ID</u></h3></th>
<th width="394" align="center"><h3><u>Last Accessed Date and Time</u></h3></th></tr>
<tr></tr>
<tr><td align="center"><script type="text/javascript">
what goes here ..???
</script>
</td><td align="center"><%=ID%></td>
<td align="center"><%=time%></td>
</tr>
</table>
i have tried using Document.getElementbyID but that doesn't works...!! and yes there's no validation in that too..!!
simply put you want to display the text which was entered in the text-box Object Finder if I am not wrong?
If yes, then you are already retrieving it in the JSP as a string obj=request.getParameter("ID"); so just use <%= obj %> wherever you want to display the value, something like:
<tr>
<td align="center">
<%= obj %>
</td>
...
I have sorted out a solution for the same, I made the database itself to store the object name along with the tag_id's.
So after that i simply retrieved the database value's using the select query, and posted the same in the table.
rs=stmt.executeQuery("Select * from tablename1 where ID='"+ ID +"'");
while(rs.next()) {
obj1=rs.getString("objj");
ID=rs.getString("ID");
time=rs.getString("time"); }
Then print the same using ..!!
<table align="center" width="800" style="border:10px solid #d2d2d2">
<tr><th align="center"><h3><u>Object</u></h3></th><th width="234" align="center"><h3><u>Tag-ID</u></h3></th>
<th width="394" align="center"><h3><u>Last Accessed Date and Time</u></h3></th></tr>
<tr></tr>
<tr><td align="center"><%=obj1%></td><td align="center"><%=ID%></td>
<td align="center"><%=time%></td>
</tr>
</table>
So this solve's my problem.

Categories

Resources