Irish SEO,  Marketing & Webmaster Discussion

 

javascript help

This is a discussion on javascript help within the Coding Help forums, part of the Webmaster Help category; hi all, can anybody show me the right way to do this, my way doesnt work. im not great with ...


Go Back   Irish SEO, Marketing & Webmaster Discussion > Webmaster Help > Coding Help

Register Forum Rules FAQDonate Members List Calendar Search Today's Posts Mark Forums Read


Notices

Reply

 

LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 19-02-2007, 12:50 PM
7aken's Avatar
Frontpage User
 
Join Date: Oct 2006
Posts: 23
Nominated 0 Times in 0 Posts
TOTW/F/M Award(s): 0
7aken will become famous soon enough
Default javascript help

hi all,

can anybody show me the right way to do this, my way doesnt work. im not great with javascript.

i want users of the following script to be able to enter a 'pin' number as an alternative to entering username/password. how do i make this happen in the below script

Code:
 
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
html, body {
 margin: 0;
 padding: 0;
}
body {
 background-color: #FFcc00;
}
-->
</style></head>
<body>
<table width="100%" height="189"  border="0" cellpadding="0">
  <tr>
    <td bordercolor="#666666"><table width="100%" height="189"  border="0" cellpadding="1">
      <tr valign="top">
        <td width="39%">$(if chap-id)
 <form name="sendin" action="$(link-login-only)" method="post">
  <input type="hidden" name="username" />
  <input type="hidden" name="password" />
    <input type="hidden" name="dst" value="$(link-orig)" />
  <input type="hidden" name="popup" value="true" />
 </form></td>
        <td width="61%">
  
     <form name="login" action="$(link-login-only)" method="post"
         $(if chap-id) onSubmit="return doLogin()" $(endif)>
      <input type="hidden" name="dst" value="$(link-orig)" />
      <input type="hidden" name="popup" value="true" />
      
       <table width="249" height="120" style="background-color: #ffcc00">
        <tr><td align="right">login</td>
          <td><input style="width: 100px" name="username" type="text" 
value="$(username)"/></td>
        </tr>
        <tr><td align="right">password</td>
          <td><input style="width: 100px" name="password" type="password"/></td>
        </tr>
       
        <tr><td>&nbsp;</td>
          <td><input type="submit" value="OK" /></td>
        </tr>
       </table>
     </form>
     <script type="text/javascript">
<!--
  document.login.username.focus();
//-->
</script>
  </td>
      </tr>
    </table></td>
 <script type="text/javascript" src="/md5.js"></script>
 <script type="text/javascript">
 <!--
     function doLogin() {
  document.sendin.username.value = document.login.username.value ; 
  document.sendin.password.value = hexMD5('$(chap-id)' + document.login.password.value + '$(chap-challenge)');
  document.sendin.submit();
  return false;
     }
 //-->
 </script>
 
  </tr>
</table>
<table width="100%" height="600px"  border="0" cellpadding="0" >
  <tr>
    <td bordercolor="#333333">
 
<iframe src="http://www.somesite.com" height="600px" width="100%" scrolling="no" frameborder="0"></iframe>

 
</td>
  </tr>
</table>
</body>
</html>
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #2 (permalink)  
Old 19-02-2007, 01:41 PM
ph3n0m's Avatar
Webmonkey
Recent Blog: Show and click
 
Join Date: Jan 2006
Location: Ireland
Posts: 300
Nominated 0 Times in 0 Posts
TOTW/F/M Award(s): 0
ph3n0m will become famous soon enough
Default

What exactly are you trying to achieve with this page?

A form that allows the user to enter a username/pin number and a password and then what?

Incidently there is nothing in your form that sends a value of "chap-id" even though by my reckoning it is required - how is the form to know if chap-id has been submitted?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #3 (permalink)  
Old 20-02-2007, 06:09 AM
7aken's Avatar
Frontpage User
 
Join Date: Oct 2006
Posts: 23
Nominated 0 Times in 0 Posts
TOTW/F/M Award(s): 0
7aken will become famous soon enough
Default

as the page is, it accepts username/password and passes it on. this page works but i see the confusion. again, im far from a javascript expert. what i would assume needs to happen is an 'elseif' type statement where if the username password fields are not filled in, it will check if the pin field is and submit that instead. im going to post the original script which is intended for a mikrotik router. the script is a hotspot login script.

original script below (the free trial part is not required)

Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title> hotspot > login</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta http-equiv="pragma" content="no-cache" />
<meta http-equiv="expires" content="-1" />
<style type="text/css">
body {color: #737373; font-size: 10px; font-family: verdana;}
textarea,input,select {
background-color: #FDFBFB;
border: 1px solid #BBBBBB;
padding: 2px;
margin: 1px;
font-size: 14px;
color: #808080;
}
a, a:link, a:visited, a:active { color: #AAAAAA; text-decoration: none; font-size: 10px; }
a:hover { border-bottom: 1px dotted #c1c1c1; color: #AAAAAA; }
img {border: none;}
td { font-size: 14px; color: #7A7A7A; }
</style>
</head>
<body>
$(if chap-id)
 <form name="sendin" action="$(link-login-only)" method="post">
  <input type="hidden" name="username" />
  <input type="hidden" name="password" />
  <input type="hidden" name="dst" value="$(link-orig)" />
  <input type="hidden" name="popup" value="true" />
 </form>
 
 <script type="text/javascript" src="/md5.js"></script>
 <script type="text/javascript">
 <!--
     function doLogin() {
  document.sendin.username.value = document.login.username.value;
  document.sendin.password.value = hexMD5('$(chap-id)' + document.login.password.value + '$(chap-challenge)');
  document.sendin.submit();
  return false;
     }
 //-->
 </script>
$(endif)
<div align="center">
<a href="$(link-login-only)?target=lv&amp;dst=$(link-orig-esc)">Latviski</a>
</div>
<table width="100%" style="margin-top: 10%;">
 <tr>
 <td align="center" valign="middle">
  <div class="notice" style="color: #c1c1c1; font-size: 9px">Please log on to use the  hotspot service<br />$(if trial == 'yes')Free trial available, <a style="color: #FF8080"href="$(link-login-only)?dst=$(link-orig-esc)&amp;username=T-$(mac-esc)">click here</a>.$(endif)</div><br />
  <table width="240" height="240" style="border: 1px solid #cccccc; padding: 0px;" cellpadding="0" cellspacing="0">
   <tr>
    <td align="center" valign="bottom" height="175" colspan="2">
     <form name="login" action="$(link-login-only)" method="post"
         $(if chap-id) onSubmit="return doLogin()" $(endif)>
      <input type="hidden" name="dst" value="$(link-orig)" />
      <input type="hidden" name="popup" value="true" />
      
       <table width="100" style="background-color: #ffffff">
        <tr><td align="right">login</td>
          <td><input style="width: 80px" name="username" type="text" value="$(username)"/></td>
        </tr>
        <tr><td align="right">password</td>
          <td><input style="width: 80px" name="password" type="password"/></td>
        </tr>
        <tr><td>&nbsp;</td>
          <td><input type="submit" value="OK" /></td>
        </tr>
       </table>
     </form>
    </td>
   </tr>
   <tr><td align="center"><a href="MikroTik Routers and Wireless" target="_blank" style="border: none;"><img src="/img/logobottom.png" alt="mikrotik" /></a></td></tr>
  </table>
 
 <br /><div style="color: #c1c1c1; font-size: 9px">Powered by mikrotik routeros &copy; 2005 mikrotik</div>
 $(if error)<br /><div style="color: #FF8080; font-size: 9px">$(error)</div>$(endif)
 </td>
 </tr>
</table>
<script type="text/javascript">
<!--
  document.login.username.focus();
//-->
</script>
</body>
</html>
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

Tags
javascript

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump

Similar Threads

Thread Thread Starter Forum Replies Last Post
Javascript - Open and configure new browser wheres me jumpa Coding Help 7 20-01-2007 04:32 PM
Javascript menu bug? ButtermilkJack Coding Help 1 15-01-2007 03:21 PM
Javascript Captcha for use on forms louie Coding Help 8 23-10-2006 09:22 AM
Javascript Menu Help (again...)? ButtermilkJack Coding Help 18 25-04-2006 12:32 PM
crossgunautos.com cr8or Site Reviews / Announcements 9 30-01-2006 12:26 AM


Sponsored links

Paid On Results


All times are GMT +1. The time now is 04:23 AM.


Powered by: vBulletin Version 3.7.3, Copyright ©2000 - 2008, Jelsoft Enterprises Limited.
Hosted in Ireland by Blacknight - Test your ISP |Irish Hosting Directory| Armchair.ie|Logo by Eden Web Design|Avatars by Afterglow |Latest Blog Entries | VPS HostingAd Management by RedTyger

Search Engine Friendly URLs by vBSEO 3.2.0