SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Wizard lorenw's Avatar
    Join Date
    Feb 2005
    Location
    was rainy Oregon now sunny Florida
    Posts
    1,098
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)

    Dynamically change a form tag

    Hi all, still beating my head for a popup window anyway I can get it.

    With JavaScript I can change the content within tag "bodies" but is it possible to change the actual tag itself.
    Code:
    <form id="loginForm" name="login" action="" method="post" onSubmit="timerWindow($username)">
    <input type="text" name="username"  value="" onBlur="doUsername();">
    I'm using onBlur on the username field so as soon as the event happens I can do the JavaScript call. What I want to do is have the username (that was just entered) passed to the timerWindow function. I think it is getting close to being solved.

    Thanks.
    What I lack in acuracy I make up for in misteaks

  2. #2
    SitePoint Wizard lorenw's Avatar
    Join Date
    Feb 2005
    Location
    was rainy Oregon now sunny Florida
    Posts
    1,098
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    I'm playing with alerts and getting somewhere.

    Code:
    <script type="text/javascript">
    function showAlert() {
    var name_uname = document.getElementById('uname');
    var uname = name_uname.value;
    	alert('you are ' + uname  + '.');
    }
    </script>
    
    <form id="loginForm" name="login" action="" method="post" onSubmit="timerWindow($username)">
    <input id=uname type="text" name="uname"  value="" onBlur="showAlert();">
    My alert is working, now just need some document write magic or something.
    Thanks
    What I lack in acuracy I make up for in misteaks

  3. #3
    SitePoint Zealot
    Join Date
    May 2009
    Location
    Netherlands
    Posts
    189
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Code:
    onsubmit="timerWindow(this.uname.value)"

  4. #4
    SitePoint Wizard lorenw's Avatar
    Join Date
    Feb 2005
    Location
    was rainy Oregon now sunny Florida
    Posts
    1,098
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Thank you, I was trying to make things much more complicated than they needed to be.
    I am happy now, thanks again.
    What I lack in acuracy I make up for in misteaks


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
  •