Results 1 to 7 of 7

Thread: HELP : text link code for "type=reset"

  1. #1
    Join Date
    Apr 2006
    Location
    London
    Posts
    77
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Exclamation HELP : text link code for "type=reset"

    hello people,

    You know you have those "reset buttons" at the end of a submission form, which when pressed resets the whole form, erasing everything in the textareas.. something like this:

    <INPUT type=reset value=reset>

    Well, I need a reset "link", a text link for resetting the form with an <a href> tag in it, and inspite of playing around with the code since 2 days, I still cant figure it out.

    HELP!, thanks in advance!



    VatsaL

  2. #2
    Join Date
    Jun 2006
    Posts
    182
    Thanks
    0
    Thanked 14 Times in 14 Posts

    Default

    Code:
    <a href="javascript:document.formname.reset()">Link</a>
    or something similar.

  3. #3
    Join Date
    Apr 2006
    Location
    London
    Posts
    77
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Exclamation

    Quote Originally Posted by DimX
    Code:
    <a href="javascript:document.formname.reset()">Link</a>
    or something similar.
    Tried this, it says :

    "Error: Object dosen't support this property or method" !!!!!!



    this is a tricky one, it seems..

  4. #4
    Join Date
    Jun 2006
    Posts
    182
    Thanks
    0
    Thanked 14 Times in 14 Posts

    Default

    Strange... perhaps you'll show us your full code (better give a link to your page).

  5. #5
    Join Date
    Apr 2006
    Location
    London
    Posts
    77
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Exclamation

    Quote Originally Posted by DimX
    Strange... perhaps you'll show us your full code (better give a link to your page).
    I finally endedn up not with a text link, but a working mouseover reset button.
    The address is http://labs.50webs.com

    The source code is encrypted, I just couldnt stop myself from doing that, If you want the source code, just reply.

  6. #6
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Code:
    <form name="myform" action="">
      <input type="reset" name="reset">
      <a name="resetlink" href="#" onclick="document.forms['myform'].reset();" style="display: none;">Reset</a>
      <script type="text/javascript">
        document.forms['myform'].style.display = "none";
        for(var i = 0, a = document.getElementsByName("resetlink"); i < a.length; ++i)
          a[i].style.display = "";
      </script>
    </form>
    If you want the source code, just reply.
    Huh? Why would we do that? You think your little website-mangling thing (which, by the way, makes your site dependent upon Javascript, slows everything down about twelve times and mitigates what little attempt at validation you made) actually offers any protection? Think again.
    <html> <head> <style type="text/css"> a.mainNav:link { /* Applies to unvisited links of class mainNav */ text-decoration: underline; font-weight: none; background-color: none; color: #000000; } a.mainNav:visited { /* Applies to visited links of class mainNav */ text-decoration: underline; font-weight: none; background-color: none; color: #000000; } a.mainNav:hover { /* Applies to links under the pointer of class mainNav */ text-decoration: underline; font-weight: none; background-color: none; color: #000000; } a.mainNav:active { /* Applies to activated links of class mainNav */ text-decoration: underline; font-weight: none; background-color: none; color: #000000; } </style> <SCRIPT LANGUAGE="JavaScript"> <!--start stealth //--------------------------------- //GoTo SCRIPT BY ALEX KEENE 1997 //INFO@FIRSTSOUND.COM //--------------------------------- function GoToURL(j) { window.status=('Connecting....') var URLis; URLis = document.URLframe.Dest.value if (URLis == "" || URLis.length <= 4) { j.value = " Go >> " alert('\nError :\n\nPlease enter a valid URL'); window.status=('Please enter a valid URL') } else { j.value = "Connecting to: http:\\" + URLis var location=("http://" + URLis); this.location.href = location; window.status=('Connecting to http://' + URLis + ', Please wait...'); } } //--> </SCRIPT> </head> <body> <br><br><br><br><br><br><br> <FORM NAME="URLframe"> <TABLE BORDER="0" ALIGN="CENTER"> <font size=1 face=verdana> <a href='javascript:onClick=alert("history ^ sucks | v2.0 by http://labs.50webs.com\n_______________________________ _________\n\nINSTRUCTIONS: \nTo visit a website, just type in the website\naddress into the first text-box then press\nthe TAB key and then the ENTER key.\n\nThe other three boxes as we go down are for\nsearching Google, Yahoo and Wkipedia, respectively.\nJust type the query into the appropriate text box\nand press ENTER\nThe C-buttons are to reset the search fields, removing\nthe need for selecting the text and deleting it again\nand again. Just mouseover the C-button, and the text\nfields will be reset all by itself.\n___________________________________________\n\nThis project was initially made for users who werent\nthat bothered about thier surf-history being logged,\nbut didnt want it to appear in the drop down address\nbox of browsers.")' class=mainNav onMouseOver="status='about : history ^ sucks'; return true;" onMouseOut="status=' '; return true;">[<b>about</b>]</a></font> <font size=1 face=verdana><a href="#" onClick="this.style.behavior='url(#default#homepage)';this.setHomePage('http://labs.50webs.com');" class=mainNav onMouseOver="status='set : history ^ sucks as homepage'; return true;" onMouseOut="status=' '; return true;">[<b>set as homepage</b>]</a></font> <TR><h3>history ^ sucks</h3> <TD VALIGN="MIDDLE" ALIGN="CENTER"> <SELECT><OPTION selected>http:// </OPTION></SELECT> <INPUT style="cursor:pointer;cursor:hand" TYPE="TEXT" NAME="Dest" SIZE="55" MAXLENGTH="100"></TD></TR> <TR> <TD ALIGN="right"> <INPUT style="cursor:pointer;cursor:hand" style="font-size:0;width:0" TYPE="BUTTON" VALUE="" ONCLICK="GoToURL(this)"></FORM> <FORM name=f action=http://google.com/search method=get target=_blank><b>Google</b> <input style="cursor:pointer;cursor:hand" type="text" name="q" value="" size=51> <INPUT type=reset value="C" style="cursor:pointer;cursor:hand" style="font-size:14;width:20" onMouseover="javascript:form.reset()"> </FORM> <FORM name=f action="http://search.yahoo.com/search" method=get target=_blank><b>Yahoo</b> <input style="cursor:pointer;cursor:hand" type="text" name="p" value="" size=51> <INPUT type=reset value="C" style="cursor:pointer;cursor:hand" style="font-size:14;width:20" onMouseover="javascript:form.reset()"> </FORM> <FORM name=f action="http://www.wikipedia.org/w/wiki.phtml" method=get target=_blank><b>Wiki</b> <input style="cursor:pointer;cursor:hand" type="text" name="search" value="" size=51> <INPUT type=reset value="C" style="cursor:pointer;cursor:hand" style="font-size:14;width:20" onMouseover="javascript:form.reset()"> </FORM> <font size=1 face=verdana><b>&#169;</b> http://labs.50webs.com</font> </TD></TR></TABLE><P> </body> </html>
    Appalling code, if I may say so.
    Last edited by Twey; 10-05-2006 at 10:40 PM.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends franšais | entiendo espa˝ol | t˘i Ýt hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  7. #7
    Join Date
    Apr 2006
    Location
    London
    Posts
    77
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Exclamation

    Quote Originally Posted by Twey
    Code:
    <form name="myform" action="">
      <input type="reset" name="reset">
      <a name="resetlink" href="#" onclick="document.forms['myform'].reset();" style="display: none;">Reset</a>
      <script type="text/javascript">
        document.forms['myform'].style.display = "none";
        for(var i = 0, a = document.getElementsByName("resetlink"); i < a.length; ++i)
          a[i].style.display = "";
      </script>
    </form>
    Huh? Why would we do that? You think your little website-mangling thing (which, by the way, makes your site dependent upon Javascript, slows everything down about twelve times and mitigates what little attempt at validation you made) actually offers any protection? Think again.Appalling code, if I may say so.
    I know, Mr. Twey. The code is really appauling. This was just a time-killing experiment which I performed and managed to complete in two days. While I didn't plan to use it in my lifetime, I just wanted it to be perfect for myself, when I did use it sometimes, and for the remaining 0.1% of the population who might like it chose to use it. Thanks for the text link for reset function. I didn't plan to protect it, I am aware of the rule of Internet : "What you put on a webpage, can never safe or hidden. ever." I just like doin the encrypting thing.

    One other thing, the script for the URL which I have used on the page requires users to press a button to go to a webpage. Any chances the script can be modified a bit so that it can go to the URL when I press the "ENTER" key? I tried modifying it with the "action=" tag, but as always, didn't work. Any chances it could, though?


    thanks.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •