designersx
asked on
error is:- content is not a function. why the function is not called
error is:- content is not a function. why the function is not called
<?php
$db_host="localhost";
$db_name="fck";
$username="root";
$password="";
$db_con=mysql_connect($db_host,$username,$password) or die("connection not build".mysql_error());
$db=mysql_select_db($db_name) or die("database not build".mysql_error());
?>
<script language="javascript" type="text/javascript">
function createObject() {
var request_type;
var browser = navigator.appName;
if(browser == "Microsoft Internet Explorer"){
request_type = new ActiveXObject("Microsoft.XMLHTTP");
} else{
request_type = new XMLHttpRequest();
}
return request_type;
}
var http = createObject();
function content(){
var content = encodeURI(document.getElementById('content').value);
alert(content)
http.open('get','content.php?content='+content, true);
http.onreadystatechange = function(){
if(http.readyState == 4){
var response = http.responseText;
document.getElementById('test').innerHTML = response;
document.getElementById('test').style.display = 'block';
}
}
http.send(null);
}
</script>
<form>
<table border="1" bgcolor="#CCCCCC" width="10%">
<tr><td colspan="2" align="center"><h2>Add Form</h2></td></tr>
<tr><td colspan="2">
<?php
$sql = "select * from `fck`";
$qid = mysql_query($sql) or die("could not select".mysql_error());
while($rec=mysql_fetch_array($qid)){
echo $content_value = $rec['content'];
}
?>
</td></tr>
<tr><td><h4>Content</h4></td><td><input type="text" name="content" id="content" value="<?php echo $content_value; ?>" /></td></tr>
<tr><td colspan="2" align="center"><input type="button" name="button" value="Add" onclick="javascript:content()" /></td></tr>
</table>
</form>
<div id="test"></div>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
The function named "content", the variable named "content" within the function and the HTML element with the ID of "content" are separate entities and should *not* be a problem.
It is confusing as all get out, but it remains valid.
This:
onclick="javascript:conten t()"
should be this:
onclick="content();"
It is confusing as all get out, but it remains valid.
This:
onclick="javascript:conten
should be this:
onclick="content();"
ASKER
>>onclick="javascript:cont ent()"
should be this:
onclick="content();"
with this the problem persists
you must have noticed that above i have input type=button , therefore the problem is coming, when i take input type=submit then problem does not come.
and my above gets solved when i apply ur first idea of changing the function name with the id.
ok no probs , now my problem is being solved thanks for that.
should be this:
onclick="content();"
with this the problem persists
you must have noticed that above i have input type=button , therefore the problem is coming, when i take input type=submit then problem does not come.
and my above gets solved when i apply ur first idea of changing the function name with the id.
ok no probs , now my problem is being solved thanks for that.
I don't know that a stdClass is. That is not a standard JavaScript object.
Thank you for the grade & points.
Good luck & have a great day.
Good luck & have a great day.
ASKER
sir what is the meaning of the below error.
Catchable fatal error: Object of class stdClass could not be converted to string in C:\wamp\www\new\modified_c