Vote count:
0
I've been following a tutorial on how to build a social network, with a group page.
You can create a group and invite people to join, have a wall etc.
The code uses a lot of javascript, ajax and php, which I have been learning.
However, I keep getting a reference error saying that my function is undefined. I've tried putting
it the function both above (in the head of the file) and below the code where it is supposed to
execute. The tutorial says its supposed to be below the "onmousedown" event.
The tutorial also says that the code provided should work, but I can see that some other people are
having the same problem.
Here is the code, my apologies as it is quite a long block..
`<a href="#"><img src ="images/group3.png" alt="groups" border="0" title="Groups"
onclick ="return false" onmousedown= "showGroups()"></a>`
var isShowing = "no";
function showGroups() {
if(isShowing == "no"){
_('groupModule').innerHTML = '<div id="groupWrapper"><div id="groupList"><h2>My Groups</h2><hr />
<?php echo $mgList; ?>
<h2>All Groups</h2><hr />
<?php echo $agList; ?></div>
<div id="groupForm"><h2>Create New Group</h2><hr />
<p>Group Name:<br />
<input type="text" id="gname" onBlur="checkGname()" >
<span id="gnamestatus"></span></p>
<p>How do people join your group?
<br /><select name="invite" id="invite">
<option value="null selected"> </option>
<option value="1">By requesting to join.</option>
<option value="2">By simply joining.</option></select></p>
<button id="newGroupBtn" onClick="createGroup()">
Create Group</button><span id="status"></span></div></div>
<div class="clear"></div>';
isShowing = "yes";
} else { _('groupModule').innerHTML = ''; isShowing = "no";
}
}
asked 1 min ago
ReferenceError: showGroups is not defined
Aucun commentaire:
Enregistrer un commentaire