www.webdeveloper.com
Results 1 to 4 of 4

Thread: Welcome popup/JavaScript

  1. #1
    Join Date
    Jul 2011
    Location
    Lost in space
    Posts
    7

    Talking Welcome popup/JavaScript

    Hello guys!
    I would really like some information, if you can tolerate a total newbie, that is . I'm trying to make a website. I've got plenty of HTML, CSS and XHTML under my belt (check out my first website here). I usually use a DOCTYPE of transitional HTML 4.01. I'm starting off with JavaScript, and I'd like to make a little welcome script on my new site's main page. Here's what I'd like it to do:
    When the page loads, I'd like for there to be a popup prompt box saying, "Welcome! Please enter your first name:" and with a small text box in it. When the user types in his/her name and hits OK (or hits Cancel instead) the script would insert the name into the first sentence of the first paragraph (I use a drop cap, by the way), like this: It would change from something like "Hello! Welcome to my site!" to something like, "Hello {name}! Welcome to my site!". And when the person came back to the home page, the script would not pop up the box again but would continue to show his/her name until the browsing window/tab were closed, in which case the person would need to re-enter the name.
    I'm sorry if I wasn't very clear here on this. I have a couple scripts on the page that won't work with the DOCTYPE tag, so I can't use it. I know that's bad practice lol, but hey, it's transitional HTML, so I'm cool there. I tried this script from W3 Schools, but it replaces everything on the page...and won't work at all on my page. Of course, though, I did omit the button, so that might be it. I want the popup to pop up when the page loads, not when it's activated by a user, so...
    Can you guys clarify a bit please?
    Thank you ever so much,
    PK

  2. #2
    Join Date
    Jul 2011
    Location
    Lost in space
    Posts
    7
    Oop, forgot the links. Happens to me when I cut and paste XD
    The link to my first web site is http://babybear.us/ and the link to the script is http://www.w3schools.com/js/tryit.as...e=tryjs_prompt

  3. #3
    Join Date
    Jul 2011
    Location
    Lost in space
    Posts
    7
    Sorry for the repeat posts, maybe a mod can merge them please?
    I also forgot to say that that script doesn't remember the name like I wanted it to, or forget it when you close the window. It writes the first sentence not till after you close the prompt, and it empties the page as well. In short, it's not what I want, but I couldn't modify it...
    BTW, is there any way to make links that glow on mouseover work on Firefox? I use both Firefox and IE....

  4. #4
    Join Date
    Jul 2011
    Location
    Lost in space
    Posts
    7
    Ahhhh, sorry yet again. I'm so annoying, I know, but please bear with me here:
    There's another script I want to use on my "contact us" page, but why won't the form work if I try to get it to both send the form results to my email AND redirect me to the homepage? (I used my other site's address in lieu of my current project's home page for this try.) The basic code I'm using is as follows:

    Code:
    <html>
    <head>
    <script type="text/javascript">
    function confirmInput()
    {
    fname=document.forms[0].fname.value;
    alert("Hello, " + fname + "! You will now be redirected to the Monkeypuzzle Manor Home Page.");
    }
    </script>
    </head>
    
    <body>
    <form method="post" action="mailto:(myemail); http://babybear.us/" enctype="text/plain" onsubmit="confirmInput()">
    <table style="border: 0px">
    <tr>
    <td>Name: </td><td><input id="fname" name="fname" type="text" size="20"></td></tr>
    <tr>
    <td>E-mail: </td><td><input type="text" name="email" size="30"></td></tr>
    <tr>
    <td>Question Type: </td><td><select name="questiontype" size="1"> <option>General question about Monkeypuzzle Manor</option><option>Inquiry about item(s) in catalog</option><option>Feedback for Monkeypuzzle Manor</option><option>Feedback about item(s) in catalog</option><option>Other question/comment type</option></select></td></tr>
    </table>
    <br />
    <input type="submit" value="Send Message"><input type="reset" value="Clear Fields">
    
    </form>
    </body>
    
    </html>

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

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



Recent Articles