View Full Version : HTML : Problem in space between words.
raveeshlawrance
03-06-2009, 12:34 AM
<table>
<tr>
<td>Flag Name </td>
<td><input style="background-color:010280; color:white" type="button" name="edit" value="Add" onclick="javascript:addContent(this.parentNode.parentNode.rowIndex,'Flag Name');"></td>
<td><input style="background-color:010280; color:white" type="button" name="edit" value="Edit" onclick="javascript:editContent(this.parentNode.parentNode.rowIndex,'Flag Name');"></td>
</tr>
</table>
<script>
function editContent(tableRow, flag_data) {
alert(flag_data);
}
</script>
It is working properly. But when i add new row with textbox value with the following data "Sample Sample". The alert box is not working... but for the data "SampleSample" it is working properly.... Please help me to solve the issue...
Pegasus
03-06-2009, 12:42 AM
If the alert box isn't working properly, then the problem is in the javascript, not the HTML. I'll just move this thread over to Client-side Scripting for you.
raveeshlawrance
03-06-2009, 12:59 AM
Thank you...
raveeshlawrance
03-06-2009, 01:23 AM
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<script language="JavaScript" src="submitAction.js"></script>
<link rel="stylesheet" href="style.css" type="text/css">
</head>
<script>
var sortedOn = 1;
function addData(form) {
var addRow = document.getElementById('results').insertRow(0);
document.getElementById("hidden").value = " ";
var flag_data = form.flag_name.value;
var flagBox = addRow.insertCell(0);
var removeButton = addRow.insertCell(1);
var editButton = addRow.insertCell(2);
flagBox.border = '1';
flagBox.align = "center";
removeButton.align = "center";
editButton.align = "center";
flagBox.innerHTML = flag_data;
removeButton.innerHTML = "<input style=\"background-color:010280; color:white\" type=\"button\" name=\"remove\" value=\"-\" onclick=\"deleteRow(this.parentNode.parentNode.rowIndex)>";
editButton.innerHTML = "<input style=\"background-color:010280; color:white\" type=\"button\" name=\"edit\" value=\"Edit\" onclick=\"javascript:editContent(this.parentNode.parentNode.rowIndex,\'"+flag_data+"\');>";
form.flag_name.value = "";
}
function editContent(tableRow, flag_data) {
alert(flag_data);
document.getElementById('flag_name').value = flag_data;
document.getElementById('hidden').value = tableRow;
}
function deleteRow(i) {
document.getElementById('results').deleteRow(i);
document.getElementById("hidden").value=" ";
}
</script>
<body>
<center>
<h4 class="welcomeText"> Global Flag Admin </h4>
</center>
<table align="center" style="width:900px;">
<tr style="background-color:010280;">
<td align="center" style="width:250px;">Flag Name</td>
</tr>
<tr>
<table id="results" align="center">
<tr align="center">
<td > Flag Name </td>
<td><input type="button" name="remove" value="-" onclick="deleteRow(this.parentNode.parentNode.rowIndex)"></td>
<td><input type="button" name="edit" value="Edit" onclick="javascript:editContent(this.parentNode.parentNode.rowIndex,'Flag Name');"></td>
</tr>
</table>
</tr>
<br><br>
<tr align = "center">
<div id = "addBox" align="middle">
<form name="myform">
<td><input type = "textbox" size = "40" value= "" id = "flag_name" name = "flag_name"></td>
<td ><input type="button" value="+" onClick="addData(this.form)"></td>
<td><input type="button" value="Update" onClick="replaceData(this.parentNode.parentNode.rowIndex, this.form)"></td>
</form>
</div>
</tr>
</table>
<br><br>
</body>
</html>
Here is my full code.. pls have a look at this code and help me..
vBulletin® v3.6.7, Copyright ©2000-2009, Jelsoft Enterprises Ltd.