Monkuar Posted May 8, 2009 Share Posted May 8, 2009 Ok look: //Send Gold time baby here we come my nig'a @@ function nGold($username="") { global $ibforums; $IPBHTML = ""; $IPBHTML .= <<<EOF <img src="gold.gif" style="cursor:hand" style="cursor:hand" onclick="sendGold({$username},event)""></a> {$username} EOF; return $IPBHTML; } That's my skin_xx.php file for : $row['nGold'] = $this->html->nGold($row['name']); Here is my JAVASCRIPT FILE: var goldOn = false; var gAuthkey=''; function sendGold(username,event) { var itm = expMenu("nGold"); goldOn = !goldOn; if(goldOn && itm) { if(itm.innerHTML=="") itm.innerHTML = "<legend>Quick Send Forum Gold<a href='javascript:sendGold()' class='hs'><img src='images!!/x.gif'></a></legend><form name='sendGoldForm' action='index.php?&act=shop&func=transfer_money&code=send' method='post' target='_blank'><input type='hidden' name='username' value='0'><table class='ftbt'><tr><td align=right>Gold Give Amount:</td><td><input type=text name='money' maxlength=7 size=7></td></tr><tr><td align=right>Optional Comments:</td><td><textarea name=post cols=20 rows=4></textarea></td></tr><tr><td align=center colspan=2><br><input type='submit' value='Submit Gold Transfer' name='submit' onclick='sendGold()'><br><br></td></tr><tr><td align=center colspan=2><a href='index.php?act=purchaseGold'>Purchase More Forum Gold</a></td></tr></table></form>"; itm.style.left=event.clientX + (window.pageXOffset!=undefined?window.pageXOffset:document.body.scrollLeft)+"px"; itm.style.top=event.clientY + (window.pageYOffset!=undefined?window.pageYOffset:document.body.scrollTop)+"px"; itm.style.zIndex="100"; sendGoldForm.username.value=username; } } It wont work if I use onclick="sendGold({$username},event)"... I have to use a number like onclick="sendGold(215125,event)" or any number to make it work?? Because then if I do let's say onclick="sendGold(monkuar,event)" then it just gives me this... monkuar is not defined [break on this error] sendGold(monkuar, event); but i need it to be work with letters and not just numbers because my code in javascript i posted above does this: <legend>Quick Send Forum Gold<a href='javascript:sendGold()' class='hs'><img src='images!!/x.gif'></a></legend><form name='sendGoldForm' action='index.php?&act=shop&func=transfer_money&code=send' method='post' target='_blank'>[u][i][b]<input type='hidden' name='username' value='0'>[/b][/i][/u]<table class='ftbt'><tr><td align=right>Gold Give Amount:</td><td><input type=text name='money' maxlength=7 size=7></td></tr><tr><td align=right>Optional Comments:</td><td><textarea name=post cols=20 rows=4></textarea></td></tr><tr><td align=center colspan=2><br><input type='submit' value='Submit Gold Transfer' name='submit' onclick='sendGold()'><br><br></td></tr><tr><td align=center colspan=2><a href='index.php?act=purchaseGold'>Purchase More Forum Gold</a></td></tr></table></form>"; The bolded part is wat i need the value= to be the members name.. but javascript wont let me do that only letters? Anyone else confused like me? Help! Link to comment https://forums.phpfreaks.com/topic/157315-weirdest-javascript-error-ever/ Share on other sites More sharing options...
Ken2k7 Posted May 8, 2009 Share Posted May 8, 2009 Nope, you're the only one confused. monkuar is treated as a variable in JavaScript. To treat it as a string, you need to put quotes around it. :-\ Link to comment https://forums.phpfreaks.com/topic/157315-weirdest-javascript-error-ever/#findComment-829160 Share on other sites More sharing options...
Monkuar Posted May 8, 2009 Author Share Posted May 8, 2009 I did: <img src="gold.gif" style="cursor:hand" style="cursor:hand" onclick="sendGold("{$username}",event)""></a> Now I got : Btw {$username} is a user of who posted on the side of my forum. And i stil get erorr: syntax error [break on this error] sendGold( All i want to do is to beable to use letters instead of numbers here: function sendGold(id,event) { Like id is just a variable but it only accepts numbers i want to use letters i tried quote and also here sendGoldForm.username.value=id; i want that to accept letters too Link to comment https://forums.phpfreaks.com/topic/157315-weirdest-javascript-error-ever/#findComment-829167 Share on other sites More sharing options...
Monkuar Posted May 8, 2009 Author Share Posted May 8, 2009 HOLY MONKEYS!! I GOT IT!! <img src="gold.gif" style="cursor:hand" style="cursor:hand" onclick="sendGold('$username',event)""></a> I ONLY HAD TO USE ' and not " WOW JAVASCRIPT IS EPIC WIN!! SO GODLY LANGUAGE THANKS MAN! 333 Link to comment https://forums.phpfreaks.com/topic/157315-weirdest-javascript-error-ever/#findComment-829177 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.