The forum of the forums
Would you like to react to this message? Create an account in a few clicks or log in to continue.

Help with 'Switch Characters' Widget

5 posters

Go down

Help with 'Switch Characters' Widget Empty Help with 'Switch Characters' Widget

Post by Dalekk7 April 2nd 2013, 3:36 am

I recently installed on my site the widget where you can "Switch Characters" easily. This is the code:

Code:
<script type="text/javascript">
function switch_accounts() {
jQuery.get(document.getElementById('logout').href, function() {
jQuery.post('/login', 'login=1&username='+document.getElementById('switch_uname').value+'&password='+document.getElementById('switch_pass').value, function () {
window.location.reload();
});
});
}
</script>
<hr />
<center>
<input id="switch_uname" type="text" /><br />
<input id="switch_pass" type="password" /><br />
<input type="button" value="Switch Accounts" onclick="switch_accounts();" /></center>

It works it's not a problem on it not working, it's just that after you've entered your username and password and you click the "Enter" key on your keyboard, it doesn't work like that, you need to move your mouse to click "Switch Accounts" and I was wondering if there was a way to allow clicking "Enter" key could work.
Dalekk7
Dalekk7
Forumember

Male Posts : 26
Reputation : 1
Language : English,Spanish,French,(Pig Latin)
Location : Miami, FL

View user profile http://hogwartsrestored.forumotion.com/

Back to top Go down

Help with 'Switch Characters' Widget Empty Re: Help with 'Switch Characters' Widget

Post by Dalekk7 April 2nd 2013, 11:54 pm

bumpp
Dalekk7
Dalekk7
Forumember

Male Posts : 26
Reputation : 1
Language : English,Spanish,French,(Pig Latin)
Location : Miami, FL

View user profile http://hogwartsrestored.forumotion.com/

Back to top Go down

Help with 'Switch Characters' Widget Empty Re: Help with 'Switch Characters' Widget

Post by SLGray April 3rd 2013, 12:20 am

Please don't double/triple post. Your post need to be separated by 24 hours before bumping, replying or adding more information. Please use the edit button instead!


Help with 'Switch Characters' Widget Slgray10

When your topic has been solved, ensure you mark the topic solved.
Never post your email in public.
SLGray
SLGray
Administrator
Administrator

Male Posts : 50338
Reputation : 3473
Language : English
Location : United States

View user profile https://forumsclub.com/gc/128-link-directory/

Back to top Go down

Help with 'Switch Characters' Widget Empty Re: Help with 'Switch Characters' Widget

Post by kirk April 4th 2013, 6:13 pm

link to your form page where it is so i can see/try it?
Have you tried on any other browsers as well?
kirk
kirk
Forumaster

Male Posts : 11037
Reputation : 653
Language : English,Vulcan,Klingon, Romulan,& Gorn

View user profile

Back to top Go down

Help with 'Switch Characters' Widget Empty Re: Help with 'Switch Characters' Widget

Post by Dalekk7 April 16th 2013, 3:16 am

http://hogwartsrestored.forumotion.com/

on the left.

Also, it'd be cool if there was a way to like when you type the first letter, a box appears to "suggest" recently typed usernames to make it faster
Dalekk7
Dalekk7
Forumember

Male Posts : 26
Reputation : 1
Language : English,Spanish,French,(Pig Latin)
Location : Miami, FL

View user profile http://hogwartsrestored.forumotion.com/

Back to top Go down

Help with 'Switch Characters' Widget Empty Re: Help with 'Switch Characters' Widget

Post by MissTiquelle April 16th 2013, 3:29 pm

I don't know about the enter thing, but to get the usernames to be suggested change both appearances of 'switch_uname' to 'username' and that should do it.

Also, is this code freely available somewhere or is it something you wrote? Would love to be able to have something like this on our site.
avatar
MissTiquelle
New Member

Posts : 3
Reputation : 0
Language : English

View user profile

Back to top Go down

Help with 'Switch Characters' Widget Empty Re: Help with 'Switch Characters' Widget

Post by Sir Chivas™ April 16th 2013, 4:33 pm

Hi,

Try using this instead:
Code:
<script type="text/javascript">
function switch_accounts() {
jQuery.get(document.getElementById('logout').href, function() {
jQuery.post('/login', 'login=1&username='+document.getElementById('switch_uname').value+'&password='+document.getElementById('switch_pass').value, function () {
window.location.reload();
});
});
}
</script>
Switch Accounts<hr />
<input id="switch_uname" type="text" /><br />
<input id="switch_pass" type="password" /><br />
<input type="button" value="Switch Accounts" onclick="switch_accounts();" />
Sir Chivas™
Sir Chivas™
Helper
Helper

Male Posts : 6825
Reputation : 434
Language : EN, FR, ES
Location : || CSS || HTML || Graphics Designs || Support ||

View user profile

Back to top Go down

Help with 'Switch Characters' Widget Empty Re: Help with 'Switch Characters' Widget

Post by Dalekk7 April 18th 2013, 5:59 am

Nope its still not working :l
Dalekk7
Dalekk7
Forumember

Male Posts : 26
Reputation : 1
Language : English,Spanish,French,(Pig Latin)
Location : Miami, FL

View user profile http://hogwartsrestored.forumotion.com/

Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum