+ Reply to Thread
Page 1 of 2 1 2 LastLast
Results 1 to 10 of 17

Thread: Javascript Accordian Help

  1. #1
    Barn Newbie Rangerbob5 is on a distinguished road Rangerbob5's Avatar
    Join Date
    Nov 2009
    Posts
    40
    Rep Power
    3

    Javascript Accordian Help

    Alright, this is my second question of the day. What I'm trying to do is implement an accordian effect to a page with limited size. I'm tring out the JQuery framework for the first time with this plugin. I have the following code on my page:

    Code:
    <%@ Language=VBScript %>
    
    <html>
    <head>
    <title>El Corte Ingl&eacute;s - Encomenda de Cabazes de Natal 2009</title>
    <link type="text/css" href="css/redmond/jquery-ui-1.7.2.custom.css" rel="stylesheet" />
    <script language="JavaScript" src="/include/funciones.js"></script>
    <script type="text/javascript" src="js/jquery-1.3.2.min.js"></script>
    <script type="text/javascript" src="js/jquery-ui-1.7.2.custom.min.js"></script>
    <script type="text/javascript">
    	$(function(){
    		// Accordion
    		$("#accordion").accordion({ header: "h3" });
    		
    		//hover states on the static widgets
    		$('#dialog_link, ul#icons li').hover(
    			function() { $(this).addClass('ui-state-hover'); }, 
    			function() { $(this).removeClass('ui-state-hover'); }
    		);
    				
    	});
    </script>
    
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    
    
    <link href="../EstilosCSS/reset.css" rel="stylesheet" type="text/css">
    <style type="text/css">
    /*demo page css*/
    
    #containerForm {width: 700px ; height: 400px}
    #left {float: left;}
    p {margin-bottom:0; margin-top:5px}
    #submit { padding-left: 480px; padding-top:10px}
    #accordian {height: 400px; width: 310px; float:right}
    
    </style>
    
    <strong> 
    <!-- Beginning of ASP Form-Handler Script -->
    <%
    'Declare variables for the e-mail script
    dim strAddr
    dim replyTo
    dim strSubject
    dim strText
    Dim RedirectURL
    'Next, declare itsReady variable so we can trigger e-mail function
    'only if user has entered an e-mail address. A real form would 
    'have a stringent error checking routine
    dim itsReady
    itsReady = ""
    'Get input from the form and assign it to script variables
    strAddr = Trim(Request.form("EMAIL"))
    if strAddr <> "" then
    replyTo = cstr(strAddr)
    end if
    
    
    strSubject = Request.form("NOME")
    strRegisto = Request.form("REGISTO")
    
    strFrase = Request.form("FRASE")
    strPergunta1 = Request.form("PERGUNTA1")
    strPergunta2 = Request.form("PERGUNTA2")
    strPergunta3 = Request.form("PERGUNTA3")
    
    
    strText = "nome: " & strSubject & vbCrLf & "email: " &  strAddr & vbCrLf &  "registo: " &  strRegisto & vbCrLf & vbCrLf & "Frase: " & strFrase & vbCrLf & "Pergunta 1: " & strPergunta1 & vbCrLf & "Pergunta 2: " &  strPergunta2 & vbCrLf & "Pergunta 3: " & strPergunta3
    'Note: use vbCrLf (as above) to add line breaks in e-mail message
    'Now trigger e-mail function if submitted with a non-blank email
    
    if strRegisto <> "" then itsReady = send_email()
    
    'The send_email function formats and sends the e-mail
    
    function send_email()
    'Create an object or container for your mail
    Dim objMail
    Set objMail = Server.CreateObject("CDO.Message")
    'Format the e-mail using fields from your HTML form<br>
    'objMail.To = "cabazesdenatal(at)elcorteingles.pt"
    objMail.bcc = "hugofroes(at)elcorteingles.pt"
    'The From address is a fake address to alert you to
    'the origin of the email. You will not reply to it. 
    objMail.ReplyTo = replyTo
    'replyTo is the email address from the form
    objMail.Subject = strSubject
    objMail.TextBody = strText
    objMail.From = "passatempo_LGl@elcorteingles.pt" 
    'The From address is a fake address to alert you to
    'the origin of the email. You will not reply to it. 
    objMail.ReplyTo = replyTo
    'replyTo is the email address from the form
    objMail.Subject = strSubject
    objMail.TextBody = strText
    objMail.Send 'comment out to test script without sending mail
    'Release system resources
    Set objMail = Nothing
    'Book example includes following line; replaced by a Javascript alert box
    'Response.Write "<h3>Thank you for using e-mail!</h3>" 
    RedirectURL = "confirmLG.asp" 
    			If RedirectURL <> "" then 
    				If Request.QueryString <> "" Then
      					response.redirect(RedirectURL & "?" & Request.QueryString)
    				else
    					response.redirect(RedirectURL)
    				end If
    			end if
    end function
     %>
    <!-- End of ASP Form-Handler Script -->
    </strong> </head> 
    
    <form action="2009_12_LG_form.asp" method="post" name="theForm">
    	
    <div id="containerForm">
    	<div id="left">
        <img src="img/001.jpg" width="390" height="400" alt="Passatempo LG e El Corte Ingl&eacute;s online"></div>
      
    	<div id="accordion">
        	<div>
    			<h3><a href="#">First</a></h3>
    			<div>
    			  <p>Clica no link para ir para a nossa <br>
    			    p&aacute;gina de registo:</p>
    			  <p>https://www.elcorteingles.pt/grupoeci/<br>
    			    grupoeci/registro/Acceso?idiom=po</p>
    			  <p>Guarda o seu n&uacute;mero de registo</p>
    			</div>
    		</div>
    		<div>
    			<h3><a href="#">Second</a></h3>
    			<div>
                	<p>Preencha os seus dados para se habilitar ao passatempo:</p>
                	<p><strong>Frase</strong><br>
                	  <input name="FRASE" type="text" style="font-size: 2.7mm; font-family= Verdana, Arial, Helvetica" size="45">
                	</p>
                	<p><strong>Pergunta 1</strong><br>
                	<input name="PERGUNTA1" type="text" style="font-size: 2.7mm; font-family= Verdana, Arial, Helvetica" size="45" maxlength="0"></p>
                	<p><strong>Pergunta 2</strong><br>
                	<input name="PERGUNTA2" type="text" style="font-size: 2.7mm; font-family= Verdana, Arial, Helvetica" size="45"></p>
                	<p><strong>Pergunta 3</strong><br>
                	<input name="PERGUNTA3" type="text" style="font-size: 2.7mm; font-family= Verdana, Arial, Helvetica" size="45"></p>
                </div>
    		</div>
    		<div>
    			<h3><a href="#">Third</a></h3>
    			<div>
                	<p>Preencha os seus dados para se habilitar ao passatempo:</p>
                	<p>Nome<br>
                	<input name="NOME" type="text" style="font-size: 2.7mm; font-family= Verdana, Arial, Helvetica" size="45" maxlength="35"></p>
                	<p>E-mail<br>
                	<input name="EMAIL" type="text" style="font-size: 2.7mm; font-family= Verdana, Arial, Helvetica" size="45" maxlength="35"></p>
                	<p>Numero de registo<br>
                	<input name="REGISTO" type="text" style="font-size: 2.7mm; font-family= Verdana, Arial, Helvetica" size="45" maxlength="20"></p>
                
                </div>
    		</div>
            <div id="submit">
            <input type="submit" value="Enviar">
            &nbsp;
            <input type="reset" value="Limpar"> 
            </div>
        </div>
    </div>
    
    </form>
    
    </body>
    
    </html>
    
    An the page is supposed to look something similar to this jQuery UI - Demos & Documentation but for some reason, it goes off the edge of the page. Any solutions?

  2. #2
    Administrator richyrich is a splendid one to behold richyrich is a splendid one to behold richyrich is a splendid one to behold richyrich is a splendid one to behold richyrich is a splendid one to behold richyrich is a splendid one to behold richyrich is a splendid one to behold richyrich's Avatar
    Join Date
    Mar 2008
    Location
    Somewhere only we know...
    Posts
    3,207
    Blog Entries
    14
    Real Name
    Rich
    Rep Power
    14

    I don't know if it's because you have declared some CSS styles on the accordian div. I don't see any styling being applied in the example you posted.

    Do you have a link to your page so we can see how it lloks?

  3. #3
    Barn Newbie Rangerbob5 is on a distinguished road Rangerbob5's Avatar
    Join Date
    Nov 2009
    Posts
    40
    Rep Power
    3

    richyRich, the page is on a testing server restricted to employees, but here's a prinscreen of what's happening. As you can see the width is limited by the div's width, but for some reason, it's shoving all of the content to the bottom. It was working fine until I decided to add text to the divs.


  4. #4
    Barn Newbie Rangerbob5 is on a distinguished road Rangerbob5's Avatar
    Join Date
    Nov 2009
    Posts
    40
    Rep Power
    3

    Is there any other "accordian" code I could use that would work?

  5. #5
    Administrator richyrich is a splendid one to behold richyrich is a splendid one to behold richyrich is a splendid one to behold richyrich is a splendid one to behold richyrich is a splendid one to behold richyrich is a splendid one to behold richyrich is a splendid one to behold richyrich's Avatar
    Join Date
    Mar 2008
    Location
    Somewhere only we know...
    Posts
    3,207
    Blog Entries
    14
    Real Name
    Rich
    Rep Power
    14

    Quote Originally Posted by Rangerbob5 View Post
    Is there any other "accordian" code I could use that would work?
    I'm just trying to set yours up as a page...Bear with me.

  6. #6
    Administrator richyrich is a splendid one to behold richyrich is a splendid one to behold richyrich is a splendid one to behold richyrich is a splendid one to behold richyrich is a splendid one to behold richyrich is a splendid one to behold richyrich is a splendid one to behold richyrich's Avatar
    Join Date
    Mar 2008
    Location
    Somewhere only we know...
    Posts
    3,207
    Blog Entries
    14
    Real Name
    Rich
    Rep Power
    14

    OK. I managed to get it working, but without any "nice" styling on it.

    I changed the page to this (removed the ASP code just to give me an htm page as well,. Hopefully you'll get the gist.
    1) Removed the additional <div> elements you had for each section.
    2) Added a "right" div to hold the right side elements.
    3) Removed the style applied to the accordion
    4) Changed the style for #left to include a width.
    5) Added a style for #right.
    6) Removed the left padding on #submit.

    It came out like this.
    Code:
    <html>
    <head>
    <title>El Corte Ingl&eacute;s - Encomenda de Cabazes de Natal 2009</title>
    <link type="text/css" href="http://static.jquery.com/ui/css/demo-docs-theme/ui.theme.css" rel="stylesheet" />
    <script language="JavaScript" src="/include/funciones.js"></script>
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.min.js"></script>
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/jquery-ui.min.js"></script>
    <script type="text/javascript">
        $(function(){
            // Accordion
            $("#accordion").accordion({ header: "h3" });
            
            //hover states on the static widgets
            $('#dialog_link, ul#icons li').hover(
                function() { $(this).addClass('ui-state-hover'); }, 
                function() { $(this).removeClass('ui-state-hover'); }
            );
                    
        });
    </script>
    
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    
    
    <link href="../EstilosCSS/reset.css" rel="stylesheet" type="text/css">
    <style type="text/css">
    /*demo page css*/
    
    #containerForm {width: 700px ; height: 400px}
    #left {float: left;width:390px;}
    p {margin-bottom:0; margin-top:5px}
    #submit { padding-top:10px}
    #right {float: right; text-align:left;width:310px;}
    
    </style>
    
    <strong> 
    <!-- Beginning of ASP Form-Handler Script -->
    
    <!-- End of ASP Form-Handler Script -->
    </strong> </head> 
    
    <form action="2009_12_LG_form.asp" method="post" name="theForm">
        
    <div id="containerForm">
        <div id="left">
        <img src="img/001.jpg" width="390" height="400" alt="Passatempo LG e El Corte Ingl&eacute;s online"></div>
      
    <div id="right">
        <div id="accordion">
                <h3><a href="#">First</a></h3>
                <div>
                  <p>Clica no link para ir para a nossa <br>
                    p&aacute;gina de registo:</p>
                  <p>https://www.elcorteingles.pt/grupoeci/<br>
                    grupoeci/registro/Acceso?idiom=po</p>
                  <p>Guarda o seu n&uacute;mero de registo</p>
                </div>
                <h3><a href="#">Second</a></h3>
                <div>
                    <p>Preencha os seus dados para se habilitar ao passatempo:</p>
                    <p><strong>Frase</strong><br>
                      <input name="FRASE" type="text" style="font-size: 2.7mm; font-family= Verdana, Arial, Helvetica" size="45">
                    </p>
                    <p><strong>Pergunta 1</strong><br>
                    <input name="PERGUNTA1" type="text" style="font-size: 2.7mm; font-family= Verdana, Arial, Helvetica" size="45" maxlength="0"></p>
                    <p><strong>Pergunta 2</strong><br>
                    <input name="PERGUNTA2" type="text" style="font-size: 2.7mm; font-family= Verdana, Arial, Helvetica" size="45"></p>
                    <p><strong>Pergunta 3</strong><br>
                    <input name="PERGUNTA3" type="text" style="font-size: 2.7mm; font-family= Verdana, Arial, Helvetica" size="45"></p>
                </div>
                <h3><a href="#">Third</a></h3>
                <div>
                    <p>Preencha os seus dados para se habilitar ao passatempo:</p>
                    <p>Nome<br>
                    <input name="NOME" type="text" style="font-size: 2.7mm; font-family= Verdana, Arial, Helvetica" size="45" maxlength="35"></p>
                    <p>E-mail<br>
                    <input name="EMAIL" type="text" style="font-size: 2.7mm; font-family= Verdana, Arial, Helvetica" size="45" maxlength="35"></p>
                    <p>Numero de registo<br>
                    <input name="REGISTO" type="text" style="font-size: 2.7mm; font-family= Verdana, Arial, Helvetica" size="45" maxlength="20"></p>
                
                </div>
    </div>
            <div id="submit">
            <input type="submit" value="Enviar">
            &nbsp;
            <input type="reset" value="Limpar"> 
            </div>
    </div>
    
    </form>
    
    </body>
    
    </html>
    
    HTH..

  7. #7
    Barn Newbie Rangerbob5 is on a distinguished road Rangerbob5's Avatar
    Join Date
    Nov 2009
    Posts
    40
    Rep Power
    3

    Thanx mate, it does seem closer, but on my page its still doesn't work a 100%... I'm think of breaking the page down to it's most basic and then build up from there... I did find another accordion script, but it's not half as complete as this one...

  8. #8
    Administrator richyrich is a splendid one to behold richyrich is a splendid one to behold richyrich is a splendid one to behold richyrich is a splendid one to behold richyrich is a splendid one to behold richyrich is a splendid one to behold richyrich is a splendid one to behold richyrich's Avatar
    Join Date
    Mar 2008
    Location
    Somewhere only we know...
    Posts
    3,207
    Blog Entries
    14
    Real Name
    Rich
    Rep Power
    14

    I think you need to be careful with the widths. I found this to be the main problem when I was trying to get it to work. If you have a fixed width layout, it may be some width settings on another element that are affecting it.

  9. #9
    Barn Newbie Rangerbob5 is on a distinguished road Rangerbob5's Avatar
    Join Date
    Nov 2009
    Posts
    40
    Rep Power
    3

    Will keep that in mind. I just found this incredible tutorial. Looks exactly like what I need. I'll try it out and tell you how it went:
    http://net.tutsplus.com/javascript-a...scriptaculous/

    Thanx again for being so patient and a huge help

  10. #10
    Barn Newbie Rangerbob5 is on a distinguished road Rangerbob5's Avatar
    Join Date
    Nov 2009
    Posts
    40
    Rep Power
    3

    And the problems continue.

    Ok, so I managed to get the Accordian working prefectly, then I made into an iFrame popup. All great. I tested it and it worked incredibly well on Firefox. Just what I wanted, but when I open it in IE 6, the popup window has loads of extra space at the bottom and the accordian seems to be bigger as well.

    i was wondering if it's becuase I'm testing it in IE 6, if there's a way around the problem and if someone could test it for me on a newer version of IE?

    I thought it would be easier to uplaod the whole group of files and folders. Here's the link to download them: Download 2009_12_passatempo_LG.zip from Sendspace.com - send big files the easy way

    The teste.html file is the one that starts everything up.

    Thanks guys

+ Reply to Thread
Page 1 of 2 1 2 LastLast

Similar Threads

  1. Javascript frameworks?
    By Rangerbob5 in forum JavaScript Programming
    Replies: 4
    Last Post: November 24th, 2009, 10:39 AM
  2. javascript problem
    By yangski in forum JavaScript Programming
    Replies: 4
    Last Post: July 28th, 2009, 08:08 AM
  3. JavaScript Tutorial
    By Shadow Wizard in forum JavaScript Programming
    Replies: 0
    Last Post: December 2nd, 2008, 07:33 AM
  4. calling javascript function from asp
    By guddu in forum ASP Development
    Replies: 8
    Last Post: November 19th, 2008, 02:48 PM

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

SEO by vBSEO