Welcome to Geeklog, Anonymous Thursday, November 28 2024 @ 09:53 pm EST

Geeklog Forums

javascript?


bdefore

Anonymous
why is it that when i try to put this within my login username input form (in lib_common.php): infocus="if(this.value=='name:')this.value='';" ... it causes a parse error?
 Quote

Status: offline

Dirk

Site Admin
Admin
Registered: 01/12/02
Posts: 13073
Location:Stuttgart, Germany
Depending on where exactly you tried to add that piece of quote (can you give or quote the exact line?), you need to escape the single ' or double " quotes. bye, Dirk
 Quote

Status: offline

Creator

Forum User
Full Member
Registered: 07/11/02
Posts: 181
Location:Austin, TX
Perhaps you should move the semicolon to the very end of the statement?
L. Whitworth
 Quote

Anonymous

Anonymous
Don't know how readable this will be, but here's the code I'm using: (if you'd like to check your own, it's lines 1191-1196 of lib_common.php) $retval .= COM_startBlock($LANG01[47]) . '<p align="right"><form action="' . $_CONF['site_url'] . '/users.php" method="post">' . LB . '<input type="text" size="10" name="loginname" value="' . $LANG01[21] . '" infocus="' . if(this.value=="name:"Winkthis.value=""; . '">' . LB . '<input type="password" size="9" name="passwd" value="asdfas"><br>' . LB . "$LANG01[59] " . '<input type="submit" value="' . $LANG01[58] . '"></form></p>' . COM_endBlock(COM_getBlockTemplate('user_block', 'footer')); Of course, the troublemaking part is this: infocus="' . if(this.value=="name:"Winkthis.value=""; . '">' . LB that's my attempt to 'escape out' of the php. i assume i'm missing something though because this isn't working either.
 Quote

Anonymous

Anonymous
yep \' did it
 Quote

All times are EST. The time is now 09:53 pm.

  • Normal Topic
  • Sticky Topic
  • Locked Topic
  • New Post
  • Sticky Topic W/ New Post
  • Locked Topic W/ New Post
  •  View Anonymous Posts
  •  Able to post
  •  Filtered HTML Allowed
  •  Censored Content