我有一个父页面,我在其中提交表单并调用on_click
提交按钮的两个函数。一个功能来自同一页面,另一个来自子页面。
我想知道如何从子页面调用父页面上的 Javascript 函数以在 Facebook 墙上发布。这是我的申请。
我的父母.php:
<form action="child.php" method="post">
<input type="text" value="$result" name="codebox">
<input type="submit" onclick="funcion codeload();function postToFeed();"/>
</form>
我的孩子.php:
<body>
<?PHP
$son=$_REQUEST['codebox'];
session_start();
$_SESSION['sony'] =$son;
$ashutosh=$_SESSION['sony'] ;
$tinyurl = file_get_contents("http://tinyurl.com/api-create.php?
url=http://www.ebhasin.com/approval/files/main.php?a=$ashutosh");
$desc='Place here description what you want';
?>
<div id='fb-root'></div>
<script src='http://connect.facebook.net/en_US/all.js'></script>
<p id='msg'></p>
<script>
FB.init({appId: "313877282043416", status: true, cookie: true});
function postToFeed() {
// calling the API ...
var obj = {
method: 'feed',
link: '<?PHP echo $tinyurl?>',
picture: 'http://www.dogoscanarios.com/en/themes/dogotheme/images/icon_dot_cat.gif',
name: 'Drum Precussion',
caption: ' I just created a new Drum Loop using Drum Beats Pro! Come listen to it!',
description: '.'
};
function callback(response) {
document.getElementById('msg').innerHTML = "Post ID: " + response['post_id'];
}
FB.ui(obj, callback);
}
</script>